{"record":{"id":"94f674b38a661896","repo":"oven-sh/bun","slug":"invalidurl-94f674","errorCode":null,"errorMessage":"InvalidURL","messagePattern":"InvalidURL","errorType":"exception","errorClass":"bun_install::Error","httpStatus":null,"severity":"error","filePath":"src/install/error.rs","lineNumber":147,"sourceCode":"    #[error(\"MissingPackageField\")]\n    MissingPackageField,\n    #[error(\"InvalidPackageField\")]\n    InvalidPackageField,\n    #[error(\"EmptyPackageField\")]\n    EmptyPackageField,\n    #[error(\"InvalidDescriptionField\")]\n    InvalidDescriptionField,\n    #[error(\"InvalidUrlField\")]\n    InvalidUrlField,\n    #[error(\"MissingLevelField\")]\n    MissingLevelField,\n    #[error(\"InvalidLevelField\")]\n    InvalidLevelField,\n    #[error(\"InvalidLevelValue\")]\n    InvalidLevelValue,\n    #[error(\"Missing global bin directory: try setting $BUN_INSTALL\")]\n    MissingGlobalBinDirectoryTrySettingBUNINSTALL,\n    #[error(\"InvalidURL\")]\n    InvalidURL,\n    #[error(\"Fail\")]\n    Fail,\n    #[error(\"IntegrityCheckFailed\")]\n    IntegrityCheckFailed,\n    #[error(\"RepositoryNotFound\")]\n    RepositoryNotFound,\n    #[error(\"DebugTextLockfileRoundTrip\")]\n    DebugTextLockfileRoundTrip,\n    #[error(\"NoPackage\")]\n    NoPackage,\n    #[error(\"BrokenPipe\")]\n    BrokenPipe,\n    #[error(\"WriteFailed\")]\n    WriteFailed,\n    #[error(\"InvalidCharacter\")]\n    InvalidCharacter,\n    #[error(\"InvalidLockfile\")]","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/install/error.rs#L129-L165","documentation":"A URL used by the install pipeline failed validation. Depending on the path: the WHATWG URL parser could not parse the string at all (url/lib.rs:323), or the resolved registry/package URL was rejected because it is not http(s):// (NetworkTask.rs:498-518), the registry and package URLs could not be joined (NetworkTask.rs:495), or the manifest URL is not on the configured registry's host/port/path (NetworkTask.rs:530-558).","triggerScenarios":"Setting a custom registry (npmScopes, --registry, or install.registry in bunfig.toml) to a value with a bad scheme (e.g. \"registry.corp\" without https://), a malformed URL, or a package whose tarball/manifest URL points to a different host than the registry — common with registry mirrors that redirect to a CDN on another domain.","commonSituations":"Typos in bunfig.toml registry URLs (missing protocol, trailing garbage); Artifactory/Nexus/proxy registries that redirect to a different hostname; scope configuration where the scoped registry differs from where the manifest actually resolves; git+ssh style URLs used where an https URL is required.","solutions":["Check the printed 'Registry URL must be http:// or https://' / 'Invalid package name' message for the exact offending URL and fix its scheme or spelling","Give the registry URL a full scheme: https://registry.npmjs.org (not registry.npmjs.org)","For mirrors that redirect to another host, configure the final host as the registry so manifest URLs stay on it","Verify the scope→registry mapping in package.json npmScopes / bunfig.toml matches where packages actually resolve"],"exampleFix":"# before (bunfig.toml)\n[install]\nregistry = \"registry.corp.internal\"\n\n# after\n[install]\nregistry = \"https://registry.corp.internal\"","handlingStrategy":"validation","validationCode":"# validate registry URLs carry a scheme and parse before installing\nfor url in $(grep -oP '(registry|url)\\s*=\\s*\"\\K[^\"]+' bunfig.toml); do\n  case \"$url\" in https://*|http://*) ;; *) echo \"bad registry URL (need http(s)://): $url\" >&2; exit 1;; esac\ndone","typeGuard":"// in JS tooling wrapping bun: check URLs up front\nconst okRegistry = (u) => { try { const p = new URL(u); return p.protocol === \"http:\" || p.protocol === \"https:\"; } catch { return false; } };","tryCatchPattern":null,"preventionTips":["Always write registry URLs with a full https:// scheme in bunfig.toml and npmScopes","For mirrors/proxies that redirect to a CDN host, configure the final host as the registry","Keep scope→registry mappings consistent with where manifests actually resolve"],"tags":["registry","url","network","configuration"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}