{"record":{"id":"5abb7b3d636e0793","repo":"nexu-io/open-design","slug":"authoritative-team-resource-listing-is-unavailable","errorCode":null,"errorMessage":"authoritative Team resource listing is unavailable","messagePattern":"authoritative Team resource listing is unavailable","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/daemon/src/collab/team-resource-share.ts","lineNumber":161,"sourceCode":"    args: string[],\n    workspaceId?: string,\n    readOptions?: TeamResourceSharedReadOptions,\n  ) => Promise<string>;\n  env?: NodeJS.ProcessEnv;\n}\n\nexport function createTeamResourceShareService(\n  options: CreateTeamResourceShareOptions,\n): TeamResourceShareService {\n  const env = options.env ?? process.env;\n  if (!shouldUseVelaCliResourceTransport(env)) {\n    return {\n      share: async () => null,\n      unshare: async () => false,\n      sharedIds: async () => [],\n      sharedResources: async (_scope, readOptions) => {\n        if (readOptions?.authoritative) {\n          throw new Error('authoritative Team resource listing is unavailable');\n        }\n        return [];\n      },\n      isShared: () => false,\n      configured: false,\n    };\n  }\n  // Distinct, colon-free id namespace on the shared hub. The caller's id (e.g.\n  // `user:palette-x`) is sanitized to path-safe chars — the hub routes the\n  // resource id as a path param, so a colon would 404.\n  const sanitizeResourceIdSegment = (value: string) => value.replace(/[^a-zA-Z0-9_-]/g, '-');\n  const scopedIdPrefixFor = (principal?: ResourceHubPrincipal | null) =>\n    principal?.teamId\n      ? `${options.idPrefix}-${sanitizeResourceIdSegment(principal.teamId)}`\n      : options.idPrefix;\n  const resourceIdFor = (id: string, principal?: ResourceHubPrincipal | null) =>\n    `${scopedIdPrefixFor(principal)}-${sanitizeResourceIdSegment(id)}`;\n  // Ids shared this session. The published resources are the durable record on","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/collab/team-resource-share.ts#L143-L179","documentation":"Thrown by the unconfigured TeamResourceShareService stub when sharedResources is called with readOptions.authoritative true. When shouldUseVelaCliResourceTransport(env) is false, the factory returns a stub whose non-authoritative reads return an empty list, but an authoritative read deliberately throws so a transport failure can never be confused with an authoritative empty list. Callers (reconciliation) must be able to tell 'unavailable' from 'genuinely empty'.","triggerScenarios":"A reconciliation or sync path requesting `sharedResources(scope, { authoritative: true })` while the Vela CLI resource transport is not enabled — e.g. local/dev without the OD_VELA collab env vars set, or collab explicitly disabled.","commonSituations":"Running the daemon locally without collab login configured, a misconfigured env that disables Vela transport, or a reconciliation job scheduled on an environment that was not provisioned for team resource sharing.","solutions":["Enable the Vela CLI resource transport via the required env vars so shouldUseVelaCliResourceTransport returns true.","If the environment is intentionally non-team, do not request authoritative reads — omit readOptions or set authoritative false.","Guard reconciliation with a check of `service.configured` before issuing an authoritative read."],"exampleFix":"// before\nconst list = await service.sharedResources(scope, { authoritative: true });\n// after\nif (!service.configured) return []; // non-team environment\nconst list = await service.sharedResources(scope, { authoritative: true });","handlingStrategy":"fallback","validationCode":"// Do not request an authoritative list from an unconfigured service.\nasync function safeSharedResources(service, scope, opts) {\n  if (opts?.authoritative && !service.configured) return null; // 'unavailable'\n  return service.sharedResources(scope, opts);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await service.sharedResources(scope, { authoritative: true });\n} catch (err) {\n  if (err instanceof Error && /authoritative Team resource listing is unavailable/.test(err.message)) {\n    // transport not configured — degrade to non-authoritative or skip reconciliation\n    return await service.sharedResources(scope); // empty list in stub mode\n  }\n  throw err;\n}","preventionTips":["Check `service.configured` before issuing authoritative reads.","Only enable authoritative reconciliation in environments where the Vela transport is provisioned.","Treat 'unavailable' and 'empty' as distinct outcomes — never paper over the throw with an empty fallback."],"tags":["collab","team-resources","vela","configuration","authoritative-read"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}