can1357/oh-my-pi · error

sharpshooter consolidation model error

Error message

sharpshooter consolidation model error

What it means

runSharpshooterConsolidation's consolidateLocked asks the model to consolidate the memory bank via a completion; if the response's stopReason is 'error' and errorMessage is empty, this generic message is thrown. The actual provider failure reason was not reported by the client, so only the fact of failure is surfaced.

Source

Thrown at packages/coding-agent/src/sharpshooter/consolidate.ts:171

		const response = await retryTransientCompletion(() =>
			completeSimple(
				model,
				{
					systemPrompt: [system],
					messages: [{ role: "user", content: [{ type: "text", text: input }], timestamp: Date.now() }],
					tools: [replaceMemoryFilesTool],
				},
				{
					apiKey: options.modelRegistry.resolver(model),
					maxTokens: 8192,
					reasoning: clampThinkingLevelForModel(model, Effort.Medium),
					toolChoice: "required",
				},
			),
		);
		if (response.stopReason === "error") {
			throw new Error(response.errorMessage || "sharpshooter consolidation model error");
		}

		const files = parseReplacementFiles(response.content, currentFiles);
		await applyReplacementFiles(bankDir, files);

		const consumedFiles = groups.flatMap(group => group.deltas.map(item => item.file));
		const deltaCount = consumedFiles.length;
		await consumeSharpshooterDeltas(consumedFiles);
		const at = Date.now();
		await writeSharpshooterState(options.agentDir, options.cwd, {
			v: 1,
			lastConsolidatedAt: at,
			lastResult: {
				at,
				sessions: groups.length,
				deltas: deltaCount,
				model: model.id,
			},

View on GitHub (pinned to 9690622007)

Solutions

  1. Enable verbose/debug logging around the consolidation request to capture status/network details.
  2. Retry the consolidation (the error is often transient network failure).
  3. Check provider status/outages and connectivity before re-running sharpshooter.
  4. If reproducible, inspect the raw HTTP exchange (proxy logs) to recover the missing error body.
  5. Consider passing apiKey/endpoint overrides to rule out auth routing issues.
Defensive patterns

Strategy: retry

Try / catch

try {
  await runSharpshooterConsolidation(args);
} catch (err) {
  if (err instanceof Error && err.message === "sharpshooter consolidation model error") {
    // unknown cause: log context, wait, retry once; escalate if it repeats
    await Bun.sleep(2000);
    await runSharpshooterConsolidation(args);
  } else throw err;
}

Prevention

When it happens

Trigger: The consolidation completion returns an error stop reason with an empty/absent errorMessage: abrupt connection drop, provider returning malformed error payloads, or a client-level failure that never produced an error string.

Common situations: Network interruption mid-request during memory consolidation; provider outage; proxy stripping error bodies; streaming connection reset before an error message could be captured.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/d45bb0be1bbd5fd1. Report an issue: GitHub.