{"record":{"id":"43258c5940f135e7","repo":"stablyai/orca","slug":"this-file-has-not-been-shared-from-the-active-orca","errorCode":null,"errorMessage":"This file has not been shared from the active Orca profile.","messagePattern":"This file has not been shared from the active Orca profile\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/artifacts/artifact-cloud-service.ts","lineNumber":208,"sourceCode":"    const idempotencyKey = randomUUID()\n    return this.withAuth(request, (token, apiUrl, auth) =>\n      this.publisher.publish(request, token, apiUrl, auth, idempotencyKey)\n    )\n  }\n\n  async update(request: ArtifactWriteRequest): Promise<ArtifactCloudOperation<ArtifactListItem>> {\n    assertArtifactSharingAllowed(this.isSharingEnabled)\n    return this.withAuth(request, (token, apiUrl, auth) =>\n      this.publisher.runForSource(request.sourceKey, auth, async () => {\n        auth.assertCurrent()\n        const record = getArtifactShareRecord(\n          auth.profileId,\n          this.userDataPath,\n          request.sourceKey,\n          auth.scope\n        )\n        if (!record) {\n          throw new Error('This file has not been shared from the active Orca profile.')\n        }\n        return this.publisher.runForSlug(record.slug, auth, async () => {\n          auth.assertCurrent()\n          const response = await artifactRequest<ArtifactListItem>(\n            apiUrl,\n            token,\n            `/${record.slug}`,\n            {\n              method: 'PUT',\n              editToken: record.editToken,\n              body: artifactWriteBody(request)\n            }\n          )\n          auth.assertCurrent()\n          refreshArtifactShareRecordExpiration(\n            auth.profileId,\n            this.userDataPath,\n            request.sourceKey,","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/artifacts/artifact-cloud-service.ts#L190-L226","documentation":"Thrown inside ArtifactCloudService.update() when getArtifactShareRecord() returns no record for the given (profileId, sourceKey, scope). The update path expects an existing share (slug + editToken) to PUT against; with no record there is nothing to update. It fires after assertArtifactSharingAllowed and inside publisher.runForSource, so auth is already resolved.","triggerScenarios":"Calling update on an artifact that was never shared, whose share record expired and was pruned, whose scope (user vs org) differs from the one used at share time, or whose record lives under a different profileId.","commonSituations":"User edits a file and hits 'update share' before the original create completed/recovered; the share-record JSON was deleted from userData; the share record was pruned because it expired; the caller passed the wrong ArtifactShareScope.","solutions":["Create/share the artifact first (createShare) to populate a share record, then call update.","Confirm the request.sourceKey and request.scope exactly match the values used when the artifact was originally shared.","Inspect the share-record store file for the active profileId and verify the record exists; if it was pruned/expired, re-share instead of updating."],"exampleFix":"// before\nawait service.update({ sourceKey, scope: 'org', ... }) // no record under 'org'\n\n// after\nconst record = getArtifactShareRecord(profileId, userDataPath, sourceKey, 'org')\nif (!record) {\n  await service.createShare({ sourceKey, scope: 'org', ... })\n  return\n}\nawait service.update({ sourceKey, scope: 'org', ... })","handlingStrategy":"validation","validationCode":"import { getArtifactShareRecord } from '...'\n\nconst record = getArtifactShareRecord(profileId, userDataPath, sourceKey, scope)\nif (!record) {\n  // nothing to update — create/share first\n  await service.createShare({ sourceKey, scope, ... })\n  return\n}\nawait service.update({ sourceKey, scope, ... })","typeGuard":"import type { ArtifactShareRecord } from '...'\n\nfunction isShareRecord(v: unknown): v is ArtifactShareRecord {\n  return typeof v === 'object' && v !== null\n    && typeof (v as ArtifactShareRecord).slug === 'string'\n    && typeof (v as ArtifactShareRecord).editToken === 'string'\n}","tryCatchPattern":"try {\n  await service.update(request)\n} catch (e) {\n  if (e instanceof Error && e.message === 'This file has not been shared from the active Orca profile.') {\n    await service.createShare(request) // fall back to create\n    return\n  }\n  throw e\n}","preventionTips":["Track share state in the UI (shared/not-shared) keyed by (sourceKey, scope) so update is only offered when a record exists.","Keep request.scope consistent across create/update/delete for the same artifact.","After a share-record prune/expiry, mark the artifact as 'not shared' to prevent stale update calls."],"tags":["artifacts","cloud","share-record","precondition"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}