{"record":{"id":"ddc86efd7275a9ec","repo":"nexu-io/open-design","slug":"design-system-backing-project-publish-failed","errorCode":null,"errorMessage":"design system backing project publish failed","messagePattern":"design system backing project publish failed","errorType":"exception","errorClass":"Error","httpStatus":500,"severity":"error","filePath":"apps/daemon/src/design-systems/team-project-share.ts","lineNumber":114,"sourceCode":"      throw new Error('design system backing project is unavailable');\n    }\n    const workspaceId = scope.principal.teamId;\n    const memberId = scope.principal.memberId;\n    const binding = options.getProjectBinding(projectId);\n    if (binding?.workspaceId && binding.workspaceId !== workspaceId) {\n      throw new Error('design system backing project belongs to another workspace');\n    }\n    if (binding?.createdByWorkspaceMemberId !== memberId) {\n      throw new TeamResourceShareForbiddenError();\n    }\n    options.onPrepared?.({ resourceId, projectId, scope });\n    return {\n      projectId,\n      transition: async (visibility) => {\n        if (visibility === 'team') {\n          const published = await options.publishProject(projectId, scope);\n          if (published.version == null) {\n            throw new Error('design system backing project publish failed');\n          }\n          try {\n            await options.persistVisibility({ projectId, scope, visibility });\n          } catch (error) {\n            try {\n              await options.unpublishProject(projectId, scope);\n            } catch (rollbackError) {\n              // Remote rollback failed, so the project publication is still\n              // Team-authoritative. Retry the local forward projection once;\n              // a transient SQLite failure can converge to the original share\n              // intent without asking the outer coordinator to make an unsafe\n              // assumption about which project state won.\n              try {\n                await options.persistVisibility({ projectId, scope, visibility });\n                return;\n              } catch (forwardError) {\n                throw compensationError(\n                  'share',","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/design-systems/team-project-share.ts#L96-L132","documentation":"Thrown during the team-visibility transition when `publishProject` resolves with a result whose `version` is null/undefined. Without a version number the remote Team publication is treated as not authoritative, so the share transition cannot commit and the preparer aborts before persisting visibility locally.","triggerScenarios":"Calling `share` on a linked design system; `publishProject(projectId, scope)` returns `{ version: null }` or `{ version: undefined }`. The remote Team hub did not assign a publication version.","commonSituations":"The Vela/Team publish adapter returned a malformed result. A remote publish partially succeeded but did not surface a version. A version mismatch between the local projection and the remote hub. An adapter bug or contract drift in the publish return shape.","solutions":["Check the publish adapter (`publishProject`) implementation and the remote hub response to confirm a version is assigned.","Retry the share once the remote Team hub is healthy and returns a non-null version.","Verify the publish result contract expects `{ version: number | null }` and that the hub actually mints a version for new publications."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before sharing, verify publish returns a version:\nconst probe = await publishProject(projectId, scope);\nif (probe.version == null) {\n  throw new Error('remote hub did not assign a publication version');\n}\n// only then proceed with the full share","typeGuard":null,"tryCatchPattern":"try {\n  await linkedShare.share(resourceId, scope);\n} catch (err) {\n  if (err instanceof Error && /publish failed/.test(err.message)) {\n    // retry once the remote Team hub is healthy and returns a version\n  }\n  throw err;\n}","preventionTips":["Ensure the publish adapter always returns a non-null version on success.","Monitor remote Team hub health before initiating shares.","Treat a null version as a non-publish, never as a silent success."],"tags":["team","design-system","workspace","share","publish","vela"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}