Skip to content

An LLM error that states its own cause is also told to check the config file #2681

Closed

Description

@argszero

Observed

When a provider refuses a request and writes down why, the daemon reports that sentence and then appends a generic remedy anyway.

The error frame in _run_tool_loop (emrg/server/daemon.py) appends . Check config at ~/.emrg/config.toml to every LLM error except a content-filter refusal, which has its own arm. Since llm.py began extracting the provider's own sentence (provider_error_message, for a JSON body carrying error.message), refusals arrive already answered — and still collect the advice:

LLM error: LLM stream request failed: 402 — 点数余额不足. Check config at ~/.emrg/config.toml

The account is empty; the configuration is fine. One remedy is printed for every cause, so the actionable half of the message competes with a pointer that sends the host to a file that was never wrong. The same holds for an invalid key, a rate limit or an unknown model: each arrives with its own sentence, and each is currently also told to check the config.

Expected

A refusal that states its cause is printed as that sentence, with no generic remedy appended. A failure that says nothing about its cause keeps the pointer — that is exactly when a host needs to know where the configuration lives.

What a fix must satisfy

  • The question is a predicate in llm.py, beside the extraction it belongs to (the is_overlong_error shape), never re-derived from the message's spelling at the daemon call site.
  • Both raise paths mark it. chat() and chat_stream() each compose a refusal sentence, and the tool loop takes the streaming one while the summariser takes the other.
  • The content-filter arm keeps its behaviour and its logging: its abort-run count is keyed to that case, and the new case must not fall into it.
  • Two guards, one each way. With the predicate ignored, the "stated cause" arm goes red; with the advice removed wholesale, the "a silent failure keeps the pointer" arm goes red.

Activity

  1. argszero commented on Nov 3, 2026

    @argszero
    OwnerAuthor

    Handled by #2682

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

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