{"record":{"id":"4be90c487515d123","repo":"can1357/oh-my-pi","slug":"the-configured-endpoint-must-use-http-or-https","errorCode":null,"errorMessage":"the configured endpoint must use HTTP or HTTPS","messagePattern":"the configured endpoint must use HTTP or HTTPS","errorType":"validation","errorClass":"LegacyDestinationError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/blob-broker/uploaders-legacy.ts","lineNumber":73,"sourceCode":"function failure(destination: BlobDestinationId, error: unknown): Error {\n\tif (error instanceof DestinationUnavailableError || error instanceof LegacyDestinationError) return error;\n\tconst message = error instanceof Error ? error.message : String(error);\n\treturn new LegacyDestinationError(destination, message, error);\n}\n\nfunction configuredEndpoint(destination: BlobDestinationId, config: DestinationRuntimeConfig): URL {\n\tconst raw = optionString(config, \"endpoint\")?.trim();\n\tif (!raw) {\n\t\tthrow new DestinationUnavailableError(destination, \"a user-supplied replacement endpoint is required\");\n\t}\n\tlet endpoint: URL;\n\ttry {\n\t\tendpoint = new URL(raw);\n\t} catch (error) {\n\t\tthrow new LegacyDestinationError(destination, \"the configured endpoint is not a valid URL\", error);\n\t}\n\tif (endpoint.protocol !== \"https:\" && endpoint.protocol !== \"http:\") {\n\t\tthrow new LegacyDestinationError(destination, \"the configured endpoint must use HTTP or HTTPS\");\n\t}\n\tconst hostname = endpoint.hostname.toLowerCase();\n\tconst blocked = BLOCKED_CUSTOM_HOSTS[destination];\n\tif (blocked) {\n\t\tfor (const domain of blocked) {\n\t\t\tif (hostname === domain || hostname.endsWith(`.${domain}`)) {\n\t\t\t\tthrow new DestinationUnavailableError(destination, \"the defunct public endpoint cannot be used\");\n\t\t\t}\n\t\t}\n\t}\n\treturn endpoint;\n}\n\nfunction sendSpaceEndpoint(config: DestinationRuntimeConfig): URL {\n\tconst endpoint = configuredEndpoint(\"sendspace\", config);\n\tif (endpoint.hostname.toLowerCase() === SENDSPACE_DEFAULT_HOST) {\n\t\tthrow new DestinationUnavailableError(\"sendspace\", \"the deprecated public discovery endpoint cannot be used\");\n\t}","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/blob-broker/uploaders-legacy.ts#L55-L91","documentation":"This LegacyDestinationError is thrown when the configured endpoint parses as a valid URL but its protocol is neither `https:` nor `http:`. The uploader only speaks HTTP(S), so schemes like `ftp:`, `file:`, `ws:`, or `data:` are rejected before any request is made.","triggerScenarios":"Setting config.endpoint for a legacy destination to a URL with a non-HTTP scheme, e.g. 'ftp://files.example.com/up', 'file:///tmp/upload', or a websocket 'wss://...' URL; the check runs in configuredEndpoint() right after successful URL parsing.","commonSituations":"Users assume other protocols are supported; accidentally pasting a `file://` local path as an endpoint; using a scheme-relative or custom internal protocol from another tool's config.","solutions":["Change the endpoint scheme to `https://` (preferred) or `http://` for local/internal networks","If the target only speaks another protocol (e.g. FTP), it is not usable as this destination's endpoint; find an HTTP gateway","Verify the full URL string in config includes the intended scheme and no `file://` path was substituted"],"exampleFix":"// before\nendpoint: ftp://files.example.com/upload\n// after\nendpoint: https://files.example.com/upload","handlingStrategy":"validation","validationCode":"const u = new URL(config.endpoint);\nif (u.protocol !== \"https:\" && u.protocol !== \"http:\") {\n  throw new Error(`endpoint scheme must be http/https, got ${u.protocol}`);\n}","typeGuard":"function isHttpProtocolUrl(u: URL): boolean {\n  return u.protocol === \"https:\" || u.protocol === \"http:\";\n}","tryCatchPattern":"try {\n  await uploader.upload(request);\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"must use HTTP or HTTPS\")) {\n    // rewrite endpoint with https:// scheme\n  } else throw err;\n}","preventionTips":["Never use file://, ftp://, or ws(s):// values as upload endpoints","Prefer https:// for all remote endpoints; http:// only for local networks","Normalize/validate scheme at configuration ingestion","Document accepted schemes in your config schema"],"tags":["configuration","url","protocol","upload"],"backgroundTag":"unsupported-url-scheme","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}