{"record":{"id":"c4d3993aa6ec3b1c","repo":"openclaw/openclaw","slug":"byteplus-video-status-response-returned-unknown-ta","errorCode":null,"errorMessage":"BytePlus video status response returned unknown task status: ${status}","messagePattern":"BytePlus video status response returned unknown task status: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"extensions/byteplus/video-generation-provider.ts","lineNumber":85,"sourceCode":"  if (!isRecord(payload)) {\n    throw new Error(`${label}: malformed JSON response`);\n  }\n  return payload as T;\n}\n\nfunction readBytePlusTaskStatus(payload: BytePlusTaskResponse): BytePlusTaskStatus {\n  const status = normalizeOptionalString(payload.status);\n  switch (status) {\n    case \"running\":\n    case \"failed\":\n    case \"queued\":\n    case \"succeeded\":\n    case \"cancelled\":\n      return status;\n    case undefined:\n      throw new Error(\"BytePlus video status response missing task status\");\n    default:\n      throw new Error(`BytePlus video status response returned unknown task status: ${status}`);\n  }\n}\n\nfunction readBytePlusErrorMessage(error: unknown): string | undefined {\n  return isRecord(error) ? normalizeOptionalString(error.message) : undefined;\n}\n\nfunction readBytePlusVideoUrl(payload: BytePlusTaskResponse): string {\n  const content = payload.content;\n  if (content !== undefined && !isRecord(content)) {\n    throw new Error(\"BytePlus video generation completed with malformed content\");\n  }\n  const videoUrl = normalizeOptionalString(content?.video_url);\n  if (!videoUrl) {\n    throw new Error(\"BytePlus video generation completed without a video URL\");\n  }\n  return videoUrl;\n}","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/openclaw/openclaw/blob/01804a75319da4b69c9ab98ceaa30477e22b8c0b/extensions/byteplus/video-generation-provider.ts#L67-L103","documentation":"Thrown by readBytePlusTaskStatus when payload.status is a recognized string type but does not match any of running/failed/queued/succeeded/cancelled. The switch default catches novel or malformed status values so the runtime does not silently misinterpret them.","triggerScenarios":"BytePlus introducing a new status string (e.g. 'paused', 'pending'), returning an uppercase variant, or a typo/whitespace in the status value.","commonSituations":"BytePlus API update adding a new lifecycle status, case-sensitivity mismatch, or an unexpected locale-specific value.","solutions":["Log the unknown status value to determine what BytePlus returned.","Update readBytePlusTaskStatus to handle the new status if it is a legitimate addition.","Normalize status to lowercase/trimmed before comparison if casing is the issue.","Report the case if it indicates an API contract change requiring a provider update."],"exampleFix":"// before\nconst status = normalizeOptionalString(payload.status);\n\n// after - normalize casing/whitespace before matching\nconst status = normalizeOptionalString(payload.status)?.trim().toLowerCase();\nif (status && !KNOWN_STATUSES.has(status)) {\n  reportUnknownBytePlusStatus(status);\n}","handlingStrategy":"try-catch","validationCode":"const KNOWN_BYTEPLUS_STATUSES = new Set(['running', 'failed', 'queued', 'succeeded', 'cancelled']);\n\nfunction isKnownBytePlusStatus(payload: unknown): boolean {\n  const status = isRecord(payload) ? normalizeOptionalString(payload.status) : undefined;\n  return typeof status === 'string' && KNOWN_BYTEPLUS_STATUSES.has(status);\n}","typeGuard":"function isKnownBytePlusStatus(value: string): boolean {\n  return new Set(['running', 'failed', 'queued', 'succeeded', 'cancelled']).has(value);\n}","tryCatchPattern":"try {\n  const status = readBytePlusTaskStatus(payload);\n} catch (error) {\n  if (/unknown task status/.test(String(error))) {\n    // log and report; possibly a new status from BytePlus\n    reportUnknownBytePlusStatus(payload.status);\n    throw error;\n  }\n  throw error;\n}","preventionTips":["Normalize status strings (trim/lowercase) before comparison.","Subscribe to BytePlus API changelogs for new lifecycle states.","Log unknown statuses so provider updates can be issued promptly."],"tags":["api","validation","byteplus","video-generation"],"backgroundTag":null,"analyzedSha":"01804a75319da4b69c9ab98ceaa30477e22b8c0b","analyzedAt":"2026-08-12T04:37:58.197Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}