{"record":{"id":"3718a36027f7b7ea","repo":"grafana/k6","slug":"open-failed-unable-to-verify-if-q-exists-reas","errorCode":null,"errorMessage":"open() failed, unable to verify if %q exists; reason: %w","messagePattern":"open\\(\\) failed, unable to verify if %q exists; reason: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/experimental/fs/module.go","lineNumber":125,"sourceCode":"\tpath = strings.TrimPrefix(path, \"file://\")\n\n\t// We resolve the path relative to the entrypoint script, as opposed to\n\t// the current working directory (the k6 command is called from).\n\t//\n\t// This is done on purpose, although it diverges in some respect with\n\t// how files are handled in different k6 contexts, so that we cater to\n\t// and intuitive user experience.\n\t//\n\t// See #2781 and #2674.\n\tpath = fsext.Abs(initEnv.CWD.Path, path)\n\n\tfs, ok := initEnv.FileSystems[\"file\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"open() failed; reason: unable to access the file system\")\n\t}\n\n\tif exists, err := fsext.Exists(fs, path); err != nil {\n\t\treturn nil, fmt.Errorf(\"open() failed, unable to verify if %q exists; reason: %w\", path, err)\n\t} else if !exists {\n\t\treturn nil, newFsError(NotFoundError, fmt.Sprintf(\"no such file or directory %q\", path))\n\t}\n\n\tif isDir, err := fsext.IsDir(fs, path); err != nil {\n\t\treturn nil, fmt.Errorf(\"open() failed, unable to verify if %q is a directory; reason: %w\", path, err)\n\t} else if isDir {\n\t\treturn nil, newFsError(\n\t\t\tInvalidResourceError,\n\t\t\tfmt.Sprintf(\"cannot open %q: opening a directory is not supported\", path),\n\t\t)\n\t}\n\n\tdata, err := mi.cache.open(path, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/experimental/fs/module.go#L107-L143","documentation":"Raised in openImpl when fsext.Exists fails while checking whether the (entrypoint-relative, file://-stripped) path exists on the 'file' filesystem. This is an I/O-level failure of the existence check itself, distinct from a plain missing-file error.","triggerScenarios":"Thrown at internal/js/modules/k6/experimental/fs/module.go:125 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error for the filesystem-level cause","Verify the path is correct relative to the init-time working directory","Check that the file is included in the archive or fsext filesystem being used"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}