{"record":{"id":"fc0dfa079db13dad","repo":"heygen-com/hyperframes","slug":"failed-to-publish-project","errorCode":null,"errorMessage":"Failed to publish project","messagePattern":"Failed to publish project","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/utils/publishProject.ts","lineNumber":576,"sourceCode":"    new File([archiveArrayBuffer(archive)], `${title}.zip`, { type: PUBLISH_CONTENT_TYPE }),\n  );\n  const headers: Record<string, string> = { ...authHeaders };\n\n  const response = await fetchForPublish(\n    `${apiBaseUrl}/v1/hyperframes/projects/publish`,\n    () => ({\n      method: \"POST\",\n      body,\n      headers,\n      signal: AbortSignal.timeout(uploadTimeoutMs(archive.buffer.byteLength)),\n    }),\n    \"Failed to publish project\",\n  );\n\n  const payload = await readJson(response);\n  const publishedProject = parsePublishedProjectResponse(payload);\n  if (!response.ok || !publishedProject) {\n    throw new Error(await readErrorMessage(response, \"Failed to publish project\"));\n  }\n\n  return publishedProject;\n}\n\nasync function uploadArchiveToPresignedUrl(\n  stagedUpload: StagedUploadResponse,\n  archive: PublishArchiveResult,\n): Promise<void> {\n  const presignedUrlTtlMs = stagedUpload.expiresInSeconds * 1000 - PUBLISH_METADATA_TIMEOUT_MS;\n  const s3Response = await fetchForPublish(\n    stagedUpload.uploadUrl,\n    () => ({\n      method: \"PUT\",\n      body: new Blob([archiveArrayBuffer(archive)], { type: stagedUpload.contentType }),\n      headers: stagedUpload.uploadHeaders,\n      signal: AbortSignal.timeout(\n        Math.min(uploadTimeoutMs(archive.buffer.byteLength), presignedUrlTtlMs),","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/cli/src/utils/publishProject.ts#L558-L594","documentation":"publishProjectArchiveDirect: the direct POST to /v1/hyperframes/projects/publish returned a Response, but either !response.ok (HTTP 4xx/5xx) OR parsePublishedProjectResponse returned null (payload missing required fields: project_id, title, url, file_count, or claim_token for anonymous publishes). readErrorMessage extracts the server's JSON message field or response body, falling back to the literal 'Failed to publish project'. This is a server-level error response, distinct from the transport-level [255].","triggerScenarios":"The API rejected the publish: authentication failed (401), rate limited (429), validation error (400 — e.g. bad title), server error (500), or the response JSON was present but malformed/incomplete (missing project_id/url/etc.). Also when an anonymous publish response omitted claim_token (which parsePublishedProjectResponse treats as invalid).","commonSituations":"Expired or invalid auth credentials; publishing a project that exceeds size/feature limits; a title with disallowed characters; the API is temporarily returning 500s; a partial service outage where the metadata endpoint is up but the publish backend is degraded; an anonymous publish where the server bug omitted claim_token.","solutions":["Read the full error message — it includes the server's response body or JSON message field.","For 401/403, refresh credentials (re-authenticate) and retry.","For 400, address the specific validation error (title characters, archive size, etc.).","For 5xx, retry after a short wait — transient server errors are common.","For malformed-response (no specific HTTP error), capture the raw response body and report it as a server bug."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return await publishProjectArchive(projectDir, opts);\n} catch (err) {\n  if (err instanceof Error && /Failed to publish project/.test(err.message)) {\n    // err.message carries the server's response text — log and surface to user\n    console.error('Publish rejected by server:', err.message);\n    // for 401/403, prompt re-auth; for 5xx, retry after backoff\n  } else throw err;\n}","preventionTips":["Re-authenticate before publishing if credentials may have expired.","Validate the project title (avoid disallowed characters) before publish.","For anonymous publishes, ensure the server returns a claim_token — if not, report it as a server bug."],"tags":["publish","api","http","authentication","validation"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}