JuliusBrussee/caveman · error · Error
Qwen safe mode ignores Caveman system settings
Error message
Qwen safe mode ignores Caveman system settings
What it means
Thrown while building the wrapped environment for the Qwen agent: agentRouteOverride reports that Qwen was launched with --safe-mode, a mode that disregards Caveman-injected system settings. Continuing would silently produce a session that ignores the gateway wrap, so the guard aborts instead of mis-wrapping.
Source
Thrown at packages/cli/src/index.ts:9054
const renderedGw = agent ? attributedGatewayUrl(gw, agent) : gw;
const env: NodeJS.ProcessEnv = {
...process.env,
...(agent?.injection.method === "native-extension" ? {} : wrapBaseUrlEnv(renderedGw)),
};
if (wrapMode(gw) === "managed") {
const gatewayKey = connectedGatewayAPIKey();
if (gatewayKey) env.CAVE_API_KEY = gatewayKey;
}
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"View on GitHub (pinned to 5184b3d11a)
Solutions
- Stop Qwen from launching with --safe-mode (remove the flag from agent args or the saved Qwen settings) so Caveman system settings take effect
- Check the resolved route override (agentRouteOverride) to see which surface and reason triggered the refusal and address that setting
- If safe mode is intentional, run Qwen outside Caveman wrapping rather than forcing the wrap
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/cli/src/index.ts:9054 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/249931afb13d1eec.
Report an issue: GitHub.