{"record":{"id":"a5da4689976e6761","repo":"stablyai/orca","slug":"the-active-orca-profile-is-not-linked-to-a-cloud-a","errorCode":null,"errorMessage":"The active Orca profile is not linked to a cloud account.","messagePattern":"The active Orca profile is not linked to a cloud account\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/artifacts/artifact-cloud-service.ts","lineNumber":102,"sourceCode":"        current.profile.id !== active.profile.id ||\n        !cloudCurrent ||\n        !isArtifactShareLifecycleCurrent(active.profile.id, userDataPath, lifecycleGeneration)\n      ) {\n        throw new Error(\n          'The signed-in Orca account changed while the artifact request was running.'\n        )\n      }\n    }\n  }\n}\n\nfunction storedSessionAuthContext(\n  active: ActiveOrcaProfileState,\n  apiOrigin: string,\n  userDataPath: string\n): ArtifactAuthContext {\n  if (!active.profile.cloud) {\n    throw new Error('The active Orca profile is not linked to a cloud account.')\n  }\n  return authContext(\n    active,\n    {\n      cloudUserId: active.profile.cloud.userId,\n      cloudProfileId: active.profile.cloud.cloudProfileId,\n      cloudOrganizationId: active.profile.cloud.activeOrgId ?? '',\n      apiOrigin\n    },\n    userDataPath,\n    {\n      userId: active.profile.cloud.userId,\n      profileId: active.profile.cloud.cloudProfileId,\n      organizationId: active.profile.cloud.activeOrgId ?? ''\n    }\n  )\n}\n","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/artifacts/artifact-cloud-service.ts#L84-L120","documentation":"Thrown by storedSessionAuthContext() when building an artifact cloud auth context for an Orca profile that has no `profile.cloud` object. Every artifact cloud operation (share/update/delete) routes through this helper, so it fires before any network call whenever the active profile is local-only. The check is a hard precondition: a cloud userId, cloudProfileId, and apiOrigin are all required to mint the session token.","triggerScenarios":"Calling ArtifactCloudService share/update/delete (or any path through withAuth -> storedSessionAuthContext) while the active Orca profile was created without linking to Orca Cloud. Also triggered if a profile's cloud link was removed but artifact operations were queued against it.","commonSituations":"A user signed in with a purely local profile and tries to share a file to the cloud; a profile-migration or sync glitch dropped the `.cloud` field; automation tests run against a default local profile without seeding a cloud link.","solutions":["Link the active Orca profile to a cloud account (sign in / re-link) so active.profile.cloud is populated, then retry the artifact operation.","Verify the active profile is the one you expect: ensureActiveOrcaProfile may be returning a local fallback — check the profile selector / userDataPath.","If this fires during automated tests, seed a cloud-linked profile (or inject a stubbed ActiveOrcaProfileState with a `.cloud` block) before invoking the service."],"exampleFix":"// before\nconst auth = storedSessionAuthContext(active, apiOrigin, userDataPath) // active.profile.cloud === undefined -> throws\n\n// after\nif (!active.profile.cloud) {\n  await promptUserToLinkCloudAccount()\n  return\n}\nconst auth = storedSessionAuthContext(active, apiOrigin, userDataPath)","handlingStrategy":"validation","validationCode":"function hasCloudLink(active: ActiveOrcaProfileState): boolean {\n  return Boolean(active.profile.cloud && active.profile.cloud.userId && active.profile.cloud.cloudProfileId)\n}\n\n// before any artifact cloud op:\nif (!hasCloudLink(active)) {\n  throw new UserError('Link this profile to Orca Cloud first.')\n}","typeGuard":"import type { ActiveOrcaProfileState } from '...'\n\nfunction isCloudLinkedProfile(active: ActiveOrcaProfileState): active is ActiveOrcaProfileState & {\n  profile: { cloud: { userId: string; cloudProfileId: string; activeOrgId?: string | null } }\n} {\n  return Boolean(active.profile.cloud && active.profile.cloud.userId && active.profile.cloud.cloudProfileId)\n}","tryCatchPattern":"null","preventionTips":["Gate all artifact-cloud UI behind a cloud-link check; surface a 'link account' CTA when active.profile.cloud is missing.","In tests, always seed ActiveOrcaProfileState with a `.cloud` block before constructing ArtifactCloudService.","Re-validate the cloud link after profile-switch events, not just at app startup."],"tags":["artifacts","cloud","auth","precondition","profile"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}