{"record":{"id":"f66fc1e0a5a6fba1","repo":"can1357/oh-my-pi","slug":"resultbaseurl-is-not-a-valid-url","errorCode":null,"errorMessage":"resultBaseUrl is not a valid URL","messagePattern":"resultBaseUrl is not a valid URL","errorType":"validation","errorClass":"LegacyDestinationError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/blob-broker/uploaders-legacy.ts","lineNumber":333,"sourceCode":"\t\t\t\t\tremoteId ? { remoteId } : undefined,\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tthrow failure(destination, error);\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction createLambdaUploader(config: DestinationRuntimeConfig, endpoint: URL): BlobUploader {\n\tconst destination = \"lambda\" as const;\n\tconst apiKey = requireCredential(config, \"apiKey\");\n\tconst resultBase = optionString(config, \"resultBaseUrl\");\n\tlet resultBaseUrl: URL = endpoint;\n\tif (resultBase) {\n\t\ttry {\n\t\t\tresultBaseUrl = new URL(resultBase);\n\t\t} catch (error) {\n\t\t\tthrow new LegacyDestinationError(destination, \"resultBaseUrl is not a valid URL\", error);\n\t\t}\n\t}\n\treturn {\n\t\tdestination,\n\t\tasync upload(request) {\n\t\t\ttry {\n\t\t\t\tconst response = await fetchFor(config)(endpoint, {\n\t\t\t\t\tmethod: \"PUT\",\n\t\t\t\t\tbody: multipartFile(request, \"file\", { api_key: apiKey }),\n\t\t\t\t});\n\t\t\t\tawait expectOk(response, destination);\n\t\t\t\tconst data = await jsonObject(destination, response);\n\t\t\t\tconst errors = data.errors;\n\t\t\t\tif (Array.isArray(errors) && errors.length > 0) {\n\t\t\t\t\tthrow new LegacyDestinationError(destination, \"the replacement endpoint rejected the upload\");\n\t\t\t\t}\n\t\t\t\tconst raw = firstString(data, [\"direct_url\", \"directUrl\", \"url\"]);\n\t\t\t\tif (!raw)","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/blob-broker/uploaders-legacy.ts#L315-L351","documentation":"Thrown at uploader construction time (createLambdaUploader, reached via createLegacyUploader) when the optional 'resultBaseUrl' option in the destination config cannot be parsed by the URL constructor. This is a configuration error, not a network problem — no request is made. The original parse error is attached as the cause.","triggerScenarios":"Calling createLegacyUploader with config option resultBaseUrl set to something like 'myhost.com/results' (missing scheme) or containing stray whitespace/characters, so new URL(resultBase) throws.","commonSituations":"Typo in config file omitting https://; copy-pasting a relative path as the base URL; environment-specific config templating leaving a placeholder value like '${RESULT_BASE}'.","solutions":["Fix the resultBaseUrl value to include the scheme, e.g. https://results.example.com/","Trim whitespace and remove template placeholders from the config value","Validate the URL in your own config loader before passing it to createLegacyUploader"],"exampleFix":"// before\n{ endpoint: \"https://lbda.net/api\", resultBaseUrl: \"results.myhost.com\" }\n// after\n{ endpoint: \"https://lbda.net/api\", resultBaseUrl: \"https://results.myhost.com\" }","handlingStrategy":"validation","validationCode":"function validateResultBaseUrl(raw: unknown): URL {\n\tif (typeof raw !== \"string\") throw new Error(\"resultBaseUrl must be a string\");\n\tconst url = new URL(raw.trim());\n\tif (url.protocol !== \"https:\" && url.protocol !== \"http:\") throw new Error(\"resultBaseUrl must be http(s)\");\n\treturn url;\n}\nvalidateResultBaseUrl(config.resultBaseUrl); // before createLegacyUploader","typeGuard":null,"tryCatchPattern":"try {\n\tconst uploader = createLegacyUploader(destination, config);\n} catch (err) {\n\tif (err instanceof Error && /resultBaseUrl is not a valid URL/.test(err.message)) {\n\t\tthrow new Error(`Fix resultBaseUrl in config for ${err.message.split(\":\")[0]} — include the scheme, e.g. https://`);\n\t}\n\tthrow err;\n}","preventionTips":["Always include the scheme (https://) in resultBaseUrl values","Validate all URL-shaped config at load time with new URL()","Avoid template placeholders leaking into config; fail fast on '${' patterns","Trim whitespace from config strings before parsing"],"tags":["configuration","url-validation","custom-endpoint"],"backgroundTag":"invalid-url-config","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}