JuliusBrussee/caveman · error · Error

${routeOverrideLabel(agent)} ${routeOverride.surface} ${rout

Error message

${routeOverrideLabel(agent)} ${routeOverride.surface} ${routeOverride.reason}

What it means

Generic guard in the environment-wrap path for agents: agentRouteOverride returned a route override whose surface and reason combination is not one of the specially handled Qwen cases, so the error surfaces the override's label, surface, and reason verbatim. The faulting input is the agent's effective settings or CLI args that produced the unhandled override.

Source

Thrown at packages/cli/src/index.ts:9062

  }
  if (!agent) return env;
  if (applyClaudeBedrockWrap(env, agent, renderedGw, gw)) return env;
  const routeOverride = agentRouteOverride(agent, agentArgs);
  if (agent.id === "qwen") {
    const override = routeOverride;
    if (override?.surface === "effective settings") {
      throw new Error("cannot safely resolve Qwen's effective settings");
    }
    if (override?.surface === "--safe-mode" && override.reason === "ignores Caveman system settings") {
      throw new Error("Qwen safe mode ignores Caveman system settings");
    }
    // These environment switches outrank settings in pinned Qwen 0.22.3.
    // Keep side-request tools and workflow-spawned agents off in routed mode;
    // corresponding system settings provide the durable second lock.
    env.ENABLE_WEB_SEARCH = "0";
    env.QWEN_CODE_DISABLE_WORKFLOWS = "1";
  }
  if (routeOverride) throw new Error(`${routeOverrideLabel(agent)} ${routeOverride.surface} ${routeOverride.reason}`);
  const inj = agent.injection;
  if (inj.method === "env") {
    for (const [k, raw] of Object.entries(inj.env)) {
      const val = renderTemplate(raw, renderedGw);
      if (val !== "") env[k] = val;
    }
  } else if (inj.method === "config-env-content") {
    const cc = inj.config_content;
    const content = wrapMode(gw) === "managed" && cc.managed !== undefined ? cc.managed : cc.local;
    const renderOptions: RenderDeepOptions = agent.id === "kilo"
      ? { optionalOpenAIKeyReference: "{env:OPENAI_API_KEY}" }
      : {};
    let rendered = renderDeep(content, renderedGw, env, renderOptions);
    if (agent.id === "kilo" && mcpMode === "auto") {
      const ownedMcp = ownedMcpRegistration(agent.id, agentArgs);
      if (ownedMcp) {
        // Project exact owned registration into Kilo's highest user-controlled
        // layer. Route preflight rejects active org/managed sources that load

View on GitHub (pinned to 5184b3d11a)

Solutions

  1. Read the surfaced surface/reason pair to identify which agent setting or CLI flag caused the route override and change that setting
  2. Update or remove agent args passed to the wrap so no route override is triggered
  3. If the override is legitimate, extend the handling in the wrap path to cover that surface/reason combination
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cli/src/index.ts:9062 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@5184b3d11a (2026-09-06). Data as JSON: /api/errors/d32822eb54a1288a. Report an issue: GitHub.