{"record":{"id":"6898c5b3e827efe0","repo":"hcengineering/platform","slug":"failed-to-upload-collaborative-document-id","errorCode":null,"errorMessage":"Failed to upload collaborative document: ${id}","messagePattern":"Failed to upload collaborative document: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/importer/src/importer/importer.ts","lineNumber":1007,"sourceCode":"  }\n\n  // Collaborative content handling\n  private async createCollaborativeContent (\n    id: Ref<Doc>,\n    collabId: CollaborativeDoc,\n    content: string,\n    spaceId: Ref<Space>\n  ): Promise<Ref<PlatformBlob>> {\n    const json = markdownToMarkup(content ?? '')\n    const processedJson = this.preprocessor.process(json, id, spaceId)\n\n    const markup = jsonToMarkup(processedJson)\n\n    const result = await this.fileUploader.uploadCollaborativeDoc(collabId, markup)\n    if (result.success) {\n      return result.id\n    }\n    throw new Error('Failed to upload collaborative document: ' + id)\n  }\n\n  async findIssueStatusByName (name: string): Promise<Ref<IssueStatus>> {\n    const query: DocumentQuery<Status> = {\n      name,\n      ofAttribute: tracker.attribute.IssueStatus\n    }\n\n    const status = await this.client.findOne(tracker.class.IssueStatus, query)\n    if (status === undefined) {\n      throw new Error('Issue status not found: ' + name)\n    }\n\n    return status._id\n  }\n\n  async uniqueProjectIdentifier (baseIdentifier: string): Promise<string> {\n    const projects = await this.client.findAll(tracker.class.Project, {})","sourceCodeStart":989,"sourceCodeEnd":1025,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/importer/src/importer/importer.ts#L989-L1025","documentation":"WorkspaceImporter converts imported markdown content into collaborative-document markup and uploads it via fileUploader.uploadCollaborativeDoc. When that upload reports success:false, the importer cannot attach collaborative content to the document and throws this error with the local document id. It signals the storage/upload backend rejected or failed the collaborative doc write.","triggerScenarios":"Any import path calling createCollaborativeContent (e.g. importOrgSpace -> createDocTemplateAttachedDoc / createControlledDocAttachedDoc) where uploadCollaborativeDoc returns { success: false } — e.g. storage service unavailable, collabId conflict, or write permission failure for the workspace.","commonSituations":"Collaborator/storage microservice down or misconfigured during a workspace import; network interruption mid-import; the target collab document id already exists in a corrupted state; insufficient storage quota or permissions for the importing account.","solutions":["Check that the collaboration/storage service used by fileUploader is reachable and healthy, then retry the import.","Inspect uploadCollaborativeDoc's result payload/logs for the underlying reason (auth, quota, duplicate collabId).","Verify the importing account has write permissions to the target workspace storage.","Re-run the import after clearing any partially-created documents from the failed attempt.","If intermittent, wrap the import step with retry/backoff around uploadCollaborativeDoc."],"exampleFix":"// before\nconst result = await this.fileUploader.uploadCollaborativeDoc(collabId, markup)\nif (result.success) {\n  return result.id\n}\nthrow new Error('Failed to upload collaborative document: ' + id)\n// after\nconst result = await this.fileUploader.uploadCollaborativeDoc(collabId, markup)\nif (result.success) {\n  return result.id\n}\nthis.logger.error('Collab doc upload failed', { id, collabId, reason: (result as any).error })\nthrow new Error('Failed to upload collaborative document: ' + id)","handlingStrategy":"try-catch","validationCode":"const ping = await fileUploader.uploadCollaborativeDoc(testCollabId, '')\nif (!ping.success) throw new Error('Collab storage unavailable before import')","typeGuard":"function isUploadSuccess(r: { success: boolean, id?: string }): r is { success: true, id: string } {\n  return r.success === true && typeof r.id === 'string'\n}","tryCatchPattern":"try {\n  const id = await importer.importOrgSpace(space)\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Failed to upload collaborative document:')) {\n    // check storage service health, then retry the import\n  } else throw err\n}","preventionTips":["Health-check the storage/collaboration service before starting large imports","Ensure the importing account has storage write permissions","Monitor storage quota and service logs during imports","Retry idempotently: clear partially created docs before re-importing"],"tags":["upload","storage","import","collaboration"],"backgroundTag":"document-upload-failed","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}