Skip to content

Ollama URL parser drops the path component for namespaced models (ollama://user/model) #85

@acato

Description

@acato

Summary

The Ollama branch of GetModelAndProvider in Writer/Interface/Wrapper.py drops the parsed.path when the URL has no @host segment. As a result, every Ollama community-namespaced model fails to load because only the username (netloc) is sent to the Ollama API as the model name.

Notably this affects this repo's own author-published model (datacrystals/midnight-miqu103b-v1), which is the recommended 64GB+ choice in Docs/Models.md.

Reproducer

# Writer/Config.py
INITIAL_OUTLINE_WRITER_MODEL = "ollama://datacrystals/midnight-miqu103b-v1"

Run ./Write.py -Prompt .... You get:

ParseResult(scheme='ollama', netloc='datacrystals', path='/midnight-miqu103b-v1', ...)
DEBUG: Loading Model datacrystals from ollama@localhost:11434
Model datacrystals not found in Ollama models. Downloading...
pulling manifest datacrystals
ollama._types.ResponseError: model 'datacrystals' not found (status code: 404)
...
ollama._types.ResponseError: pull model manifest: file does not exist (status code: -1)

The framework correctly preserves netloc + path in the sibling @-host branch a few lines above (line ~495) and in the openrouter branch — only the no-@ Ollama branch has the bug.

Root cause

Writer/Interface/Wrapper.py, the no-@ Ollama branch (currently around line 498):

elif "ollama" in _Model:
    if "@" in parsed.path:
        Model = parsed.netloc + parsed.path.split("@")[0]   # correctly concatenates
        Host = parsed.path.split("@")[1]
    else:
        Model = parsed.netloc          # ← drops parsed.path
        Host = "localhost:11434"

For ollama://datacrystals/midnight-miqu103b-v1, urlparse returns netloc='datacrystals' and path='/midnight-miqu103b-v1', but only netloc is used.

Proposed fix

One-line change:

else:
    Model = parsed.netloc + parsed.path
    Host = "localhost:11434"

This matches the existing pattern used in the @-host branch and the openrouter branch. PR to follow.

Impact

Any user attempting to use a namespaced Ollama model (username/modelname) hits this. That's a very large class — most non-official-library Ollama models are namespaced. The fix is one line; the workaround is to ollama cp the model to a non-namespaced local tag, which is undocumented friction for new users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions