continuedev/continue · error · Error
Depth must be a number
Error message
Depth must be a number
What it means
The WatsonX streaming chat request returned a non-ok status or had no body, and the raw response text is embedded. This is the generic upstream failure for WatsonX chat streaming (auth, space/project id, model id, network).
Source
Thrown at core/context/providers/GitCommitContextProvider.ts:111
name: query,
description: `commit ${query}`,
content,
},
];
}
} catch (err) {
return [];
}
}
async loadSubmenuItems(
args: LoadSubmenuItemsArgs,
): Promise<ContextSubmenuItem[]> {
const depth = this.options?.Depth ?? 50;
const lastXCommitsDepth = this.options?.LastXCommitsDepth ?? 10;
if (typeof depth !== "number") {
throw new Error("Depth must be a number");
}
if (typeof lastXCommitsDepth !== "number") {
throw new Error("LastXCommitsDepth must be a number");
}
const topLevelDir = fileURLToPath((await args.ide.getWorkspaceDirs())[0]);
try {
const gitResult = await runGitCommand(
[
"--no-pager",
"log",
'--pretty=format:"%H%x00%s"',
`-n`,
depth.toString(),
],
topLevelDir,
);
const recentCommits = [View on GitHub (pinned to 5522c6f44c)
Solutions
- Read the embedded response.text() — WatsonX states the exact reason (401 token, 404 project/model)
- Refresh the IAM/access token before long-lived streaming sessions
- Verify project/space id and that the model is available in your WatsonX region
- Wrap stream start in retry-with-backoff for transient 5xx
Defensive patterns
Strategy: retry
Try / catch
try { for await (const c of api.chatCompletionStream(body, signal)) {} } catch (e) { const msg = (e as Error).message; if (/401|token/i.test(msg)) { await refreshToken(); return retry(); } if (/429|5\d\d/.test(msg)) await backoff(); else throw e; } Prevention
- Refresh WatsonX IAM tokens on a schedule shorter than their TTL
- Validate project id and model availability at startup
- Capture the embedded response text in error logs
When it happens
Trigger: Expired/invalid IAM token in headers; wrong project_id or watsonx.ai space; model id not available to the account; TLS/proxy issues producing non-2xx; empty body on early connection close.
Common situations: IAM token from WatsonX Machine Learning expires mid-session and streams start failing; wrong WATSONX_PROJECT_ID env var; model gated by entitlement in the WatsonX catalog.
Related errors
- GitLab Private Token is required!
- Error getting prompt: MCP Connection ${serverName} not found
- Unsupported transport type: ${this.options.type}
- MCP Connection ${serverId} not found
- no query params found
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/65acce773f6d13bd.
Report an issue: GitHub.