{"record":{"id":"1e86f19c8987072f","repo":"stablyai/orca","slug":"too-many-artifact-creates-are-waiting-for-recovery","errorCode":null,"errorMessage":"Too many artifact creates are waiting for recovery. Retry an earlier share.","messagePattern":"Too many artifact creates are waiting for recovery\\. Retry an earlier share\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/main/artifacts/artifact-create-intent-store.ts","lineNumber":204,"sourceCode":"}\n\nexport function getOrCreateArtifactCreateIntent(\n  profileId: string,\n  userDataPath: string,\n  sourceKey: string,\n  scope: ArtifactShareScope,\n  idempotencyKey: string,\n  body: ArtifactWriteBody\n): ArtifactCreateIntent {\n  const existing = getArtifactCreateIntent(profileId, userDataPath, sourceKey, scope)\n  if (existing) {\n    return existing\n  }\n  const directory = ensureIntentDirectory(profileId, userDataPath)\n  removeTemporaryIntents(directory)\n  const pendingCount = readdirSync(directory).filter((name) => name.endsWith('.json')).length\n  if (pendingCount >= MAX_PENDING_ARTIFACT_CREATES) {\n    throw new Error('Too many artifact creates are waiting for recovery. Retry an earlier share.')\n  }\n  const intent: ArtifactCreateIntent = {\n    version: 1,\n    sourceKey,\n    scope,\n    idempotencyKey,\n    body\n  }\n  const serializedIntent = JSON.stringify(intent, null, 2)\n  if (Buffer.byteLength(serializedIntent, 'utf8') > MAX_ARTIFACT_CREATE_INTENT_BYTES) {\n    throw new Error('Artifact create recovery record exceeds the supported size.')\n  }\n  writeIntent(intentPath(profileId, userDataPath, sourceKey, scope), directory, serializedIntent)\n  return intent\n}\n\nexport function removeArtifactCreateIntent(\n  profileId: string,","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/artifacts/artifact-create-intent-store.ts#L186-L222","documentation":"Thrown by getOrCreateArtifactCreateIntent() when the intents directory already holds MAX_PENDING_ARTIFACT_CREATES (32) or more .json files after pruning temporary intents. The cap prevents unbounded recovery backlog from a chronically-failing cloud-create. Each pending intent represents a share create that never confirmed.","triggerScenarios":"Repeatedly attempting to share new artifacts while prior creates stay unrecovered (network down, cloud auth failing, app crashing before confirmation). The backlog hits 32 and the next create is refused.","commonSituations":"The cloud endpoint is unreachable for an extended period and the user keeps queuing shares; a bug prevents create-confirmation from clearing intents; an automation hammers share-create on a broken connection.","solutions":["Recover or clear earlier pending creates first — retry/flush the existing 32 shares (or deliberately abandon them) to drop below the cap.","Diagnose why creates are not confirming: check cloud connectivity, auth (740/743), and that removeArtifactCreateIntent is called on success.","If the backlog is genuinely stale, clear the intents directory for the profile and re-share from a known-good state."],"exampleFix":"// before\ngetOrCreateArtifactCreateIntent(...) // 32 pending -> throws\n\n// after\n// flush stale pending intents first\nfor (const stale of listPendingIntents(profileId, userDataPath)) {\n  await retryCreateOrAbandon(stale)\n}\ngetOrCreateArtifactCreateIntent(...)","handlingStrategy":"validation","validationCode":"import { readdirSync } from 'node:fs'\nimport { MAX_PENDING_ARTIFACT_CREATES, ensureIntentDirectory } from '...'\n\nfunction pendingIntentCount(profileId: string, userDataPath: string): number {\n  const dir = ensureIntentDirectory(profileId, userDataPath)\n  return readdirSync(dir).filter((n) => n.endsWith('.json')).length\n}\n\nif (pendingIntentCount(profileId, userDataPath) >= MAX_PENDING_ARTIFACT_CREATES) {\n  await flushOrAbandonPendingIntents(profileId, userDataPath) // recover/clear before queueing\n}","typeGuard":"null","tryCatchPattern":"try {\n  return getOrCreateArtifactCreateIntent(profileId, userDataPath, sourceKey, scope, idempotencyKey, body)\n} catch (e) {\n  if ((e as Error).message === 'Too many artifact creates are waiting for recovery. Retry an earlier share.') {\n    await flushOrAbandonPendingIntents(profileId, userDataPath)\n    return getOrCreateArtifactCreateIntent(profileId, userDataPath, sourceKey, scope, idempotencyKey, body)\n  }\n  throw e\n}","preventionTips":["Surface pending-recovery counts in the UI and prompt users to retry/abandon earlier shares before they hit the cap.","Confirm successful creates call removeArtifactCreateIntent so the backlog does not grow.","Back off share-create automation when cloud connectivity is down to avoid filling the queue."],"tags":["artifacts","recovery","backpressure","quota","intent-store"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}