Mintplex-Labs/anything-llm · warning · Error

HTTP ${resp.status}: ${(await resp.text()).slice(0, 200)}

Error message

HTTP ${resp.status}: ${(await resp.text()).slice(0, 200)}

What it means

Thrown by runPromptPreflight when the LLM preflight HTTP call returns non-2xx. The message captures the status code and the first 200 bytes of the response body. The endpoint uses tool_choice:'required' to force a tool call that classifies the prompt routing mode. The throw is caught by the surrounding try and downgrades to a 'simple' routing decision with a reason string, so preflight failure is non-fatal.

Source

Thrown at open-computer/services/interface-service/preflight/index.js:150

                    type: "array",
                    items: { type: "string" },
                    description:
                      "For plan_first or delegate_sequential: 3-6 compact bullets to guide execution.",
                  },
                },
                required: ["mode", "reason"],
              },
            },
          },
        ],
        tool_choice: "required",
      }),
    });

    clearTimeout(timeout);

    if (!resp.ok) {
      throw new Error(
        `HTTP ${resp.status}: ${(await resp.text()).slice(0, 200)}`,
      );
    }

    const data = await resp.json();
    const args = parsePreflightToolArgs(data.choices?.[0]?.message);
    const mode =
      args.mode === "delegate_sequential"
        ? "delegate_sequential"
        : args.mode === "plan_first"
          ? "plan_first"
          : "simple";
    return {
      mode,
      reason: String(args.reason || "model decision").slice(0, 200),
      plan_hint: mode !== "simple" ? normalizePlanHint(args.plan_hint) : [],
    };
  } catch (err) {

View on GitHub (pinned to 526360e320)

Solutions

  1. Check the captured status + 200-byte body in the warning log: `[preflight] failed, defaulting to simple: ...`.
  2. Verify the preflight LLM API key and model name are valid.
  3. Reduce the prompt/system-prompt size if the body indicates a context-window error.
  4. Accept the 'simple' fallback for non-critical prompts; preflight is an optimization, not a hard dependency.
Defensive patterns

Strategy: fallback

Validate before calling

// Verify the preflight provider is reachable before relying on routing.
async function preflightReachable(apiKey, model) {
  if (!apiKey) return false;
  // a cheap /models ping is enough
  return true;
}

Try / catch

// The library already downgrades to 'simple' on failure; respect that.
const decision = await runPromptPreflight(prompt);
// decision.mode is always one of simple|plan_first|delegate_sequential
useRoutingMode(decision.mode);

Prevention

When it happens

Trigger: The preflight LLM provider returns 401 (bad key), 429 (rate limit), 500 (provider error), the request payload exceeded the model's context window, or the provider's tool-calling endpoint is unsupported.

Common situations: LLM provider API key rotated but not updated in config; burst traffic hitting a rate limit; prompt+system-prompt overrunning a small-context model; provider temporarily degraded; model name configured that no longer exists.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/11842e6e82e70d9f. Report an issue: GitHub.