{"record":{"id":"fd8169cff0a25bff","repo":"grafana/k6","slug":"only-supported-schemes-for-imports-are-file-and-ht","errorCode":null,"errorMessage":"only supported schemes for imports are file and https, %s has `%s`","messagePattern":"only supported schemes for imports are file and https, (.+?) has `(.+?)`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/loader/loader.go","lineNumber":64,"sourceCode":"\n// Resolve a relative path to an absolute one.\nfunc Resolve(pwd *url.URL, moduleSpecifier string) (*url.URL, error) {\n\tif moduleSpecifier == \"\" {\n\t\treturn nil, errors.New(\"local or remote path required\")\n\t}\n\n\tif moduleSpecifier[0] == '.' || moduleSpecifier[0] == '/' || filepath.IsAbs(moduleSpecifier) {\n\t\treturn resolveFilePath(pwd, moduleSpecifier)\n\t}\n\n\tif strings.Contains(moduleSpecifier, \"://\") {\n\t\tu, err := url.Parse(moduleSpecifier)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif u.Scheme != \"file\" && u.Scheme != \"https\" {\n\t\t\treturn nil,\n\t\t\t\tfmt.Errorf(\"only supported schemes for imports are file and https, %s has `%s`\",\n\t\t\t\t\tmoduleSpecifier, u.Scheme)\n\t\t}\n\t\tif u.Scheme == \"file\" && pwd.Scheme == \"https\" {\n\t\t\treturn nil, fmt.Errorf(\"origin (%s) not allowed to load local file: %s\", pwd, moduleSpecifier)\n\t\t}\n\t\treturn u, err\n\t}\n\n\tif strings.HasPrefix(moduleSpecifier, \"cdnjs.com\") {\n\t\treturn nil, fmt.Errorf(\"cdnjs.com 'special' urls are no longer supported - please use real ones. \" +\n\t\t\t\"You can get yours by going to cdnjs and copy-pasting the full url to the actual JavaScript file\")\n\t}\n\tif strings.HasPrefix(moduleSpecifier, \"github.com\") {\n\t\treturn nil, fmt.Errorf(\"github.com 'special' urls are no longer supported - please use real ones. \" +\n\t\t\t\"You can get yours by going to github and copy-pasting the full url to the actual raw JavaScript file\")\n\t}\n\treturn nil, unresolvableURLError(moduleSpecifier)\n}","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/loader/loader.go#L46-L82","documentation":"A validation guard in Resolve. k6 only loads modules via file:// or https:// URLs; it fires when an import specifier containing '://' uses any other scheme (e.g. http://, ws://). The at-fault inputs are the module specifier and its unsupported scheme.","triggerScenarios":"Thrown at internal/loader/loader.go:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use https:// for remote modules instead of http://","Use file:// or a relative/absolute path for local modules","Import from a supported CDN over https (e.g. jslib.k6.io)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}