{"record":{"id":"d3b3d0d0a6643461","repo":"can1357/oh-my-pi","slug":"litterbox-option-ttl-must-be-one-of-1h-12h-24h","errorCode":null,"errorMessage":"litterbox option ttl must be one of 1h, 12h, 24h, or 72h","messagePattern":"litterbox option ttl must be one of 1h, 12h, 24h, or 72h","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/blob-broker/uploaders-anonymous.ts","lineNumber":92,"sourceCode":"\t\t\t\t\"catbox\",\n\t\t\t\tconfig,\n\t\t\t\tCATBOX_UPLOAD_URL,\n\t\t\t\tmultipartFile(request, \"fileToUpload\", fields),\n\t\t\t);\n\t\t\tconst id = remoteName(url);\n\t\t\tconst deleteAction =\n\t\t\t\tuserHash && id\n\t\t\t\t\t? formDelete(CATBOX_UPLOAD_URL, { reqtype: \"deletefiles\", userhash: userHash, files: id })\n\t\t\t\t\t: undefined;\n\t\t\treturn publication(\"catbox\", request, url, { remoteId: id, delete: deleteAction });\n\t\t},\n\t};\n}\n\nfunction litterboxTtl(config: DestinationRuntimeConfig): keyof typeof LITTERBOX_TTLS {\n\tconst ttl = optionString(config, \"ttl\", \"24h\");\n\tif (ttl && Object.hasOwn(LITTERBOX_TTLS, ttl)) return ttl as keyof typeof LITTERBOX_TTLS;\n\tthrow new Error(\"litterbox option ttl must be one of 1h, 12h, 24h, or 72h\");\n}\n\nfunction createLitterboxUploader(config: DestinationRuntimeConfig): BlobUploader {\n\treturn {\n\t\tdestination: \"litterbox\",\n\t\tasync upload(request: BlobUploadRequest) {\n\t\t\tconst ttl = litterboxTtl(config);\n\t\t\tconst { url } = await uploadTextUrl(\n\t\t\t\t\"litterbox\",\n\t\t\t\tconfig,\n\t\t\t\tLITTERBOX_UPLOAD_URL,\n\t\t\t\tmultipartFile(request, \"fileToUpload\", { reqtype: \"fileupload\", time: ttl }),\n\t\t\t);\n\t\t\treturn publication(\"litterbox\", request, url, {\n\t\t\t\texpiresAt: Date.now() + LITTERBOX_TTLS[ttl],\n\t\t\t\tremoteId: remoteName(url),\n\t\t\t});\n\t\t},","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/blob-broker/uploaders-anonymous.ts#L74-L110","documentation":"litterboxTtl validates the litterbox `ttl` option against the exact set Litterbox supports (1h, 12h, 24h, 72h) and throws for anything else. Litterbox's API only accepts these four expiry values; the runtime rejects arbitrary durations up front instead of getting an opaque API error.","triggerScenarios":"Configuring a litterbox destination with `ttl` set to a value outside {\"1h\",\"12h\",\"24h\",\"72h\"} — e.g. \"48h\", \"1d\", \"7d\", \"24 hr\", or a number like 24 — so Object.hasOwn(LITTERBOX_TTLS, ttl) is false.","commonSituations":"Users copying tmpfiles-style duration syntax (\"48h\", \"2d\") into litterbox config, assuming any duration works, or specifying the default in a different casing (\"24H\").","solutions":["Set ttl to exactly one of \"1h\", \"12h\", \"24h\", or \"72h\" (lowercase, no spaces).","Remove the ttl option entirely to use the 24h default.","If you need a different expiry, choose a destination that supports arbitrary durations (e.g. tmpfiles with its own bounds)."],"exampleFix":"// before\n{ \"destination\": \"litterbox\", \"options\": { \"ttl\": \"48h\" } }\n// after\n{ \"destination\": \"litterbox\", \"options\": { \"ttl\": \"72h\" } }","handlingStrategy":"validation","validationCode":"const LITTERBOX_TTLS = [\"1h\", \"12h\", \"24h\", \"72h\"] as const;\nconst ttl = config.options.ttl ?? \"24h\";\nif (!(LITTERBOX_TTLS as readonly string[]).includes(String(ttl))) throw new Error(`litterbox ttl must be one of ${LITTERBOX_TTLS.join(\", \")}`);","typeGuard":"const isLitterboxTtl = (v: unknown): v is \"1h\" | \"12h\" | \"24h\" | \"72h\" => v === \"1h\" || v === \"12h\" || v === \"24h\" || v === \"72h\";","tryCatchPattern":"try {\n  uploader = createLitterboxDestination(config);\n} catch (err) {\n  if (String(err).includes(\"litterbox option ttl\")) {\n    logger.warn(\"falling back to default litterbox ttl 24h\");\n    config.options.ttl = \"24h\";\n    uploader = createLitterboxDestination(config);\n  } else throw err;\n}","preventionTips":["Copy the exact allowed values: 1h, 12h, 24h, 72h — lowercase, no spaces.","Encode the enum in your config schema so invalid values are caught at load time.","Omit ttl to accept the 24h default."],"tags":["config","validation","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}