{"record":{"id":"d45bb0be1bbd5fd1","repo":"can1357/oh-my-pi","slug":"sharpshooter-consolidation-model-error","errorCode":null,"errorMessage":"sharpshooter consolidation model error","messagePattern":"sharpshooter consolidation model error","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/sharpshooter/consolidate.ts","lineNumber":171,"sourceCode":"\n\t\tconst response = await retryTransientCompletion(() =>\n\t\t\tcompleteSimple(\n\t\t\t\tmodel,\n\t\t\t\t{\n\t\t\t\t\tsystemPrompt: [system],\n\t\t\t\t\tmessages: [{ role: \"user\", content: [{ type: \"text\", text: input }], timestamp: Date.now() }],\n\t\t\t\t\ttools: [replaceMemoryFilesTool],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tapiKey: options.modelRegistry.resolver(model),\n\t\t\t\t\tmaxTokens: 8192,\n\t\t\t\t\treasoning: clampThinkingLevelForModel(model, Effort.Medium),\n\t\t\t\t\ttoolChoice: \"required\",\n\t\t\t\t},\n\t\t\t),\n\t\t);\n\t\tif (response.stopReason === \"error\") {\n\t\t\tthrow new Error(response.errorMessage || \"sharpshooter consolidation model error\");\n\t\t}\n\n\t\tconst files = parseReplacementFiles(response.content, currentFiles);\n\t\tawait applyReplacementFiles(bankDir, files);\n\n\t\tconst consumedFiles = groups.flatMap(group => group.deltas.map(item => item.file));\n\t\tconst deltaCount = consumedFiles.length;\n\t\tawait consumeSharpshooterDeltas(consumedFiles);\n\t\tconst at = Date.now();\n\t\tawait writeSharpshooterState(options.agentDir, options.cwd, {\n\t\t\tv: 1,\n\t\t\tlastConsolidatedAt: at,\n\t\t\tlastResult: {\n\t\t\t\tat,\n\t\t\t\tsessions: groups.length,\n\t\t\t\tdeltas: deltaCount,\n\t\t\t\tmodel: model.id,\n\t\t\t},","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/sharpshooter/consolidate.ts#L153-L189","documentation":"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.","triggerScenarios":"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.","commonSituations":"Network interruption mid-request during memory consolidation; provider outage; proxy stripping error bodies; streaming connection reset before an error message could be captured.","solutions":["Enable verbose/debug logging around the consolidation request to capture status/network details.","Retry the consolidation (the error is often transient network failure).","Check provider status/outages and connectivity before re-running sharpshooter.","If reproducible, inspect the raw HTTP exchange (proxy logs) to recover the missing error body.","Consider passing apiKey/endpoint overrides to rule out auth routing issues."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await runSharpshooterConsolidation(args);\n} catch (err) {\n  if (err instanceof Error && err.message === \"sharpshooter consolidation model error\") {\n    // unknown cause: log context, wait, retry once; escalate if it repeats\n    await Bun.sleep(2000);\n    await runSharpshooterConsolidation(args);\n  } else throw err;\n}","preventionTips":["Log full request/response context around consolidation to recover causes when errorMessage is empty.","Retry transients automatically — the client already retries transient completions, so persistent failure means real outage.","Monitor provider status; pause consolidation during known incidents.","Check network/proxy health if this recurs without provider-side errors."],"tags":["llm-api","consolidation","unknown-error"],"backgroundTag":"llm-request-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}