JuliusBrussee/caveman · error
cannot safely resolve Qwen's effective settings
Error message
cannot safely resolve Qwen's effective settings
What it means
While building the wrapped environment for the Qwen CLI, the wrapper consults a route-override table describing CLI surfaces Qwen handles unsafely under managed routing. If the user's arguments/config touch the 'effective settings' surface (Qwen would resolve settings in a way the wrapper cannot statically reason about), buildWrapEnv throws instead of producing an environment whose routing and settings could disagree. It is a fail-fast guard for the pinned Qwen version where env switches and settings interact non-obviously.
Solutions
- Remove the Qwen argument/config combination that triggers the 'effective settings' route override — launch Qwen with default settings so the wrapper can compute its environment safely.
- Inspect the route override table (agentRouteOverride) and update it for your Qwen version so the surface is no longer overridden, if you have verified the version behaves safely.
- Run Qwen outside the managed wrap (direct gateway/direct provider credentials) if you need those settings-affecting flags.
Example fix
// before caveman agent qwen --settings-file ./custom.json # override: 'effective settings' // after caveman agent qwen # default settings, wrapper resolves env safely
Defensive patterns
Strategy: validation
Validate before calling
// Pre-check before launching qwen through the wrapper
const override = getRouteOverride(agent, agentArgs);
if (override?.surface === "effective settings") {
throw new Error("Qwen launch would hit the 'effective settings' route override; remove settings-affecting flags.");
} Try / catch
try {
caveman.launch({ agent: "qwen", args });
} catch (e) {
if (e instanceof Error && e.message === "cannot safely resolve Qwen's effective settings") {
console.error("Remove settings-affecting Qwen flags or run Qwen outside the managed wrap.");
} else throw e;
} Prevention
- Keep Qwen launched via Caveman on default settings files; manage overrides through Caveman config instead.
- Pin the Qwen version the wrapper was tested against so route overrides stay accurate.
- Review agent scripts for flags that alter settings resolution before routing them through the managed wrap.
When it happens
Trigger: Calling buildWrapEnv with the qwen agent profile when agentRouteOverride(agent, agentArgs) returns an override whose surface is "effective settings" — i.e. the supplied agent arguments or saved route config map Qwen's launch onto the settings-resolution surface (for example a settings/config-affecting flag combination registered as unsafe).
Common situations: Passing Qwen CLI flags that change which settings files are loaded while relying on Caveman-managed routing; upgrading the pinned Qwen version so route overrides no longer match; hand-edited agent route config entries that mark the effective-settings surface as overridden.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- Qwen safe mode ignores Caveman system settings
- ${routeOverrideLabel(agent)} ${routeOverride.surface}…
- cannot safely resolve Qwen's effective OPENAI_API_KEY
- managed Bedrock wrap requires a valid CAVE_API_KEY
- Qwen routed profile is missing
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/66029235f2536db3.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/index.ts:9358
if (agent?.id === "gemini" && wrapMode(gw) === "managed") {
throw new Error("managed Gemini CLI routing is unsupported because Gemini CLI cannot send separate Caveman and upstream credentials");
}
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") {View on GitHub (pinned to 3ee70a1026)