Skip to content

Failed to parse grammar - opencode #534

Closed

Description

@remcocats

When I try to connect opencode with the docker model I only get this answer:
Failed to parse grammar

My open code configuration is:

"dmr": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Docker Model Runner",
      "options": {
        "baseURL": "http://localhost:12434/engines/v1"
      },
      "models": {
        "ai/qwen3-coder": {
          "name": "Qwen3 Coder"
        }
      }
    }

I use a macbook pro and have installed Docker model with version: Docker Model Runner version v1.0.2

I also tried it using my new gigabyte AI TOP ATOM.

"dmr": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Docker Model Runner",
      "options": {
        "baseURL": "http://localhost:12434/engines/v1"
      },
      "models": {
        "ai/qwen3-coder": {
          "name": "Qwen3 Coder"
        }
      }
    }

With Docker Model Runner version v1.0.6

I followed the instruction based on: www.docker.com/blog/new-nvidia-spark-docker-model-runner/

I hope someone can help me out

Activity

  1. ericcurtin commented on Dec 24, 2025

    @ericcurtin
    Contributor

    Could you build and test this when it's complete @remcocats ?

    ericcurtin#80

    copilot doesn't always understand or fix the issue. But it's worth a shot before a deeper debug session.

  2. remcocats commented on Dec 24, 2025

    @remcocats
    Author

    I will give it a try

  3. remcocats commented on Dec 24, 2025

    @remcocats
    Author

    I have tried the fix it didn't help. But I tried something else as well. I removed the mcp's from opencode and that helped.

  4. ericcurtin commented on Dec 24, 2025

    @ericcurtin
    Contributor

    Interesting, thanks for trying, might be worth opening a documentation PR here:

    https://github.com/sst/opencode

  5. remcocats commented on Dec 24, 2025

    @remcocats
    Author

    the output log from the fix with mcp is as follows:

    INFO[0064] root-tool-call-multiple-with-end ::= root-tool-call-once root-tool-call-more* root-call-end  component=llama.cpp
    INFO[0064] root-tool-call-once ::= bash-call | read-call | glob-call | grep-call | list-call | edit-call | write-call | task-call | webfetch-call | todowrite-call | todoread-call | skill-call | playwright-browser-close-call | playwright-browser-resize-call | playwright-browser-console-messages-call | playwright-browser-handle-dialog-call | playwright-browser-evaluate-call | playwright-browser-file-upload-call | playwright-browser-fill-form-call | playwright-browser-install-call | playwright-browser-press-key-call | playwright-browser-type-call | playwright-browser-navigate-call | playwright-browser-navigate-back-call | playwright-browser-network-requests-call | playwright-browser-take-screenshot-call | playwright-browser-snapshot-call | playwright-browser-click-call | playwright-browser-drag-call | playwright-browser-hover-call | playwright-browser-select-option-call | playwright-browser-tabs-call | playwright-browser-wait-for-call | duckduckgo-search-call | duckduckgo-fetch-content-call | backlog-get-workflow-overview-call | backlog-get-task-creation-guide-call | backlog-get-task-execution-guide-call | backlog-get-task-completion-guide-call | backlog-task-create-call | backlog-task-list-call | backlog-task-search-call | backlog-task-edit-call | backlog-task-view-call | backlog-task-archive-call | backlog-task-complete-call | backlog-milestone-list-call | backlog-milestone-add-call | backlog-milestone-rename-call | backlog-milestone-remove-call | backlog-document-list-call | backlog-document-view-call | backlog-document-create-call | backlog-document-update-call | backlog-document-search-call | context7-resolve-library-id-call | context7-get-library-docs-call  component=llama.cpp
    INFO[0064] skill-arg-after-0 ::= func-skill-kv-name skill-last-arg-end  component=llama.cpp
    INFO[0064] skill-arg-after-0-with-sep ::= "\n</parameter>\n" func-skill-kv-name skill-last-arg-end  component=llama.cpp
    INFO[0064] skill-call ::= "<function=" "skill" ">\n" skill-arg-after-0  component=llama.cpp
    INFO[0064] skill-last-arg-end ::= "\n</parameter>\n"     component=llama.cpp
    INFO[0064] space ::= | " " | "\n"{1,2} [ \t]{0,20}       component=llama.cpp
    INFO[0064] string ::= "\"" char* "\"" space              component=llama.cpp
    INFO[0064] string-arg-val ::= ( [^\x0A] | "\x0A" ( [^<] | "<" ( [^/] | "/" ( [^p] | "p" ( [^a] | "a" ( [^r] | "r" ( [^a] | "a" ( [^m] | "m" ( [^e] | "e" ( [^t] | "t" ( [^e] | "e" ( [^r] | "r" ( [^>] | ">" ( [^\x0A] ) ) ) ) ) ) ) ) ) ) ) ) ) )*  component=llama.cpp
    INFO[0064] task-arg-after-0 ::= func-task-kv-description task-arg-after-1-with-sep  component=llama.cpp
    INFO[0064] task-arg-after-0-with-sep ::= "\n</parameter>\n" func-task-kv-description task-arg-after-1-with-sep  component=llama.cpp
    INFO[0064] task-arg-after-1 ::= func-task-kv-prompt task-arg-after-2-with-sep  component=llama.cpp
    INFO[0064] task-arg-after-1-with-sep ::= "\n</parameter>\n" func-task-kv-prompt task-arg-after-2-with-sep  component=llama.cpp
    INFO[0064] task-arg-after-2 ::= func-task-kv-subagent-type task-arg-after-3-with-sep  component=llama.cpp
    INFO[0064] task-arg-after-2-with-sep ::= "\n</parameter>\n" func-task-kv-subagent-type task-arg-after-3-with-sep  component=llama.cpp
    INFO[0064] task-arg-after-3 ::= ( func-task-kv-session-id task-arg-after-4-with-sep ) | task-arg-after-4  component=llama.cpp
    INFO[0064] task-arg-after-3-with-sep ::= ( "\n</parameter>\n" func-task-kv-session-id task-arg-after-4-with-sep ) | task-arg-after-4-with-sep  component=llama.cpp
    INFO[0064] task-arg-after-4 ::= ( func-task-kv-command task-last-arg-end ) | ""  component=llama.cpp
    INFO[0064] task-arg-after-4-with-sep ::= ( "\n</parameter>\n" func-task-kv-command task-last-arg-end ) | task-last-arg-end  component=llama.cpp
    INFO[0064] task-call ::= "<function=" "task" ">\n" task-arg-after-0  component=llama.cpp
    INFO[0064] task-last-arg-end ::= "\n</parameter>\n"      component=llama.cpp
    INFO[0064] todoread-call ::= "<function=" "todoread" ">\n" ""  component=llama.cpp
    INFO[0064] todoread-last-arg-end ::= "\n</parameter>\n"  component=llama.cpp
    INFO[0064] todowrite-arg-after-0 ::= func-todowrite-kv-todos todowrite-last-arg-end  component=llama.cpp
    INFO[0064] todowrite-arg-after-0-with-sep ::= "\n</parameter>\n" func-todowrite-kv-todos todowrite-last-arg-end  component=llama.cpp
    INFO[0064] todowrite-arg-todos ::= "[" space (todowrite-arg-todos-item ("," space todowrite-arg-todos-item)*)? "]" space  component=llama.cpp
    INFO[0064] todowrite-arg-todos-item ::= "{" space todowrite-arg-todos-item-content-kv "," space todowrite-arg-todos-item-status-kv "," space todowrite-arg-todos-item-priority-kv "," space todowrite-arg-todos-item-id-kv "}" space  component=llama.cpp
    INFO[0064] todowrite-arg-todos-item-content-kv ::= "\"content\"" space ":" space string  component=llama.cpp
    INFO[0064] todowrite-arg-todos-item-id-kv ::= "\"id\"" space ":" space string  component=llama.cpp
    INFO[0064] todowrite-arg-todos-item-priority-kv ::= "\"priority\"" space ":" space string  component=llama.cpp
    INFO[0064] todowrite-arg-todos-item-status-kv ::= "\"status\"" space ":" space string  component=llama.cpp
    INFO[0064] todowrite-call ::= "<function=" "todowrite" ">\n" todowrite-arg-after-0  component=llama.cpp
    INFO[0064] todowrite-last-arg-end ::= "\n</parameter>\n"  component=llama.cpp
    INFO[0064] webfetch-arg-after-0 ::= func-webfetch-kv-url webfetch-arg-after-1-with-sep  component=llama.cpp
    INFO[0064] webfetch-arg-after-0-with-sep ::= "\n</parameter>\n" func-webfetch-kv-url webfetch-arg-after-1-with-sep  component=llama.cpp
    INFO[0064] webfetch-arg-after-1 ::= func-webfetch-kv-format webfetch-arg-after-2-with-sep  component=llama.cpp
    INFO[0064] webfetch-arg-after-1-with-sep ::= "\n</parameter>\n" func-webfetch-kv-format webfetch-arg-after-2-with-sep  component=llama.cpp
    INFO[0064] webfetch-arg-after-2 ::= ( func-webfetch-kv-timeout webfetch-last-arg-end ) | ""  component=llama.cpp
    INFO[0064] webfetch-arg-after-2-with-sep ::= ( "\n</parameter>\n" func-webfetch-kv-timeout webfetch-last-arg-end ) | webfetch-last-arg-end  component=llama.cpp
    INFO[0064] webfetch-arg-format ::= ("\"text\"" | "\"markdown\"" | "\"html\"") space  component=llama.cpp
    INFO[0064] webfetch-call ::= "<function=" "webfetch" ">\n" webfetch-arg-after-0  component=llama.cpp
    INFO[0064] webfetch-last-arg-end ::= "\n</parameter>\n"  component=llama.cpp
    INFO[0064] write-arg-after-0 ::= func-write-kv-content write-arg-after-1-with-sep  component=llama.cpp
    INFO[0064] write-arg-after-0-with-sep ::= "\n</parameter>\n" func-write-kv-content write-arg-after-1-with-sep  component=llama.cpp
    INFO[0064] write-arg-after-1 ::= func-write-kv-filePath write-last-arg-end  component=llama.cpp
    INFO[0064] write-arg-after-1-with-sep ::= "\n</parameter>\n" func-write-kv-filePath write-last-arg-end  component=llama.cpp
    INFO[0064] write-call ::= "<function=" "write" ">\n" write-arg-after-0  component=llama.cpp
    INFO[0064] write-last-arg-end ::= "\n</parameter>\n"     component=llama.cpp
    INFO[0064]                                               component=llama.cpp
    INFO[0064] llama_grammar_init_impl: failed to parse grammar  component=llama.cpp
    INFO[0064] srv    send_error: task id = 0, error: Failed to parse grammar  component=llama.cpp
    INFO[0064] srv  process_sing: failed to launch slot with task, id_task = 0  component=llama.cpp
    INFO[0064] srv  update_slots: all slots are idle         component=llama.cpp
    INFO[0064] srv          stop: cancel task, id_task = 0   component=llama.cpp
    INFO[0064] srv  update_slots: all slots are idle         component=llama.cpp
    INFO[0064] srv  log_server_r: request: POST /v1/chat/completions  400  component=llama.cpp
    
  6. remcocats commented on Dec 24, 2025

    @remcocats
    Author

    the tools works for lmstudio and ollama implementation

  7. ericcurtin commented on Dec 24, 2025

    @ericcurtin
    Contributor

    Are you interested in working on this? It's:

    make && ./model-runner serve --host 0.0.0.0 --port 13434
    

    to run a new DMR server to test. Would be a nice contribution.

  8. remcocats commented on Dec 24, 2025

    @remcocats
    Author

    Hi I can try, but I'm not a go specialist, my background is Java, typescript,

    btw, I have narrowed it to one specific MCP server that is the backlog.md MCP server.

    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "backlog": {
          "type": "local",
          "command": [ "backlog",
            "mcp",
            "start"
          ],
          "enabled": true
        }
      }
    }
    
  9. remcocats commented on Dec 24, 2025

    @remcocats
    Author

    After some digging the issue is inside the docker-model-backend-laamacpp. It's the way how the grammer is parsed for the tooling.

  10. ericcurtin commented on Jan 11, 2026

    @ericcurtin
    Contributor

    @remcocats what platform are you on? The first thing to try would be to see if this occurs with the latest llama.cpp and vLLM . Then update in DMR if it's just an update.

  11. ericcurtin commented on Jan 11, 2026

    @ericcurtin
    Contributor
  12. remcocats commented on Jan 11, 2026

    @remcocats
    Author

    @remcocats what platform are you on? The first thing to try would be to see if this occurs with the latest llama.cpp and vLLM . Then update in DMR if it's just an update.

    I use a nvidia spark. I now use a vllm container with ftp-Oss-120b that works now I haven’t got the time to go deeper in the investigation. My main programming language is Java and not python

  13. ericcurtin commented on Jan 11, 2026

    @ericcurtin
    Contributor

    Ok, please reopen if you encounter again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions