stablyai/orca · error

Artifact create recovery record does not match its storage i

Error message

Artifact create recovery record does not match its storage identity.

What it means

Thrown by getArtifactCreateIntent() after successfully reading an intent: the record's internal sourceKey/scope do not match the (sourceKey, scope) derived from the storage path. This is an integrity guard — an intent file must describe the same artifact it is filed under. A mismatch implies the file was moved, misnamed, or corrupted.

Source

Thrown at src/main/artifacts/artifact-create-intent-store.ts:183

  ) {
    throw new Error('Artifact create recovery record has an unsupported format.')
  }
  return intent as ArtifactCreateIntent
}

export function getArtifactCreateIntent(
  profileId: string,
  userDataPath: string,
  sourceKey: string,
  scope: ArtifactShareScope
): ArtifactCreateIntent | null {
  const path = intentPath(profileId, userDataPath, sourceKey, scope)
  if (!existsSync(path)) {
    return null
  }
  const intent = readIntent(path)
  if (intent.sourceKey !== sourceKey || !scopeMatches(intent.scope, scope)) {
    throw new Error('Artifact create recovery record does not match its storage identity.')
  }
  return intent
}

export function getOrCreateArtifactCreateIntent(
  profileId: string,
  userDataPath: string,
  sourceKey: string,
  scope: ArtifactShareScope,
  idempotencyKey: string,
  body: ArtifactWriteBody
): ArtifactCreateIntent {
  const existing = getArtifactCreateIntent(profileId, userDataPath, sourceKey, scope)
  if (existing) {
    return existing
  }
  const directory = ensureIntentDirectory(profileId, userDataPath)
  removeTemporaryIntents(directory)

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Delete the mismatched intent file — it cannot be safely recovered to a different sourceKey/scope.
  2. Re-trigger the share create for the correct (sourceKey, scope) to mint a fresh matching intent.
  3. If migrating path layout, write a one-time migration that re-keys intent contents alongside file renames.

Example fix

// before
// file at sourceKey='A' path contains sourceKey='B' -> throws on recovery

// after
// delete the mismatched file; recovery for 'A' returns null and the share is re-created cleanly
Defensive patterns

Strategy: validation

Validate before calling

import { getArtifactCreateIntent } from '...'

try {
  const intent = getArtifactCreateIntent(profileId, userDataPath, sourceKey, scope)
} catch (e) {
  if ((e as Error).message === 'Artifact create recovery record does not match its storage identity.') {
    // file mislabeled — cannot safely re-key; abandon + re-share
    await quarantineIntentFile(intentPath(profileId, userDataPath, sourceKey, scope))
    return null
  }
  throw e
}

Type guard

function intentMatchesIdentity(intent: { sourceKey: string; scope: unknown }, sourceKey: string, scope: unknown): boolean {
  return intent.sourceKey === sourceKey && scopeMatches(intent.scope as any, scope as any)
}

Try / catch

try {
  return getArtifactCreateIntent(profileId, userDataPath, sourceKey, scope)
} catch (e) {
  if ((e as Error).message === 'Artifact create recovery record does not match its storage identity.') {
    await quarantineIntentFile(intentPath(profileId, userDataPath, sourceKey, scope))
    return null
  }
  throw e
}

Prevention

When it happens

Trigger: The intent file was copied/renamed to another sourceKey's path; scope was changed in the filename/path layout but the content was not updated; two sourceKeys collided onto the same path; a manual edit changed sourceKey inside the JSON.

Common situations: A path-layout migration rewrote intentPath() but did not migrate file contents; a backup restore placed files under wrong keys; a user copied intent files between profiles.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/411c5ae02a067db3. Report an issue: GitHub.