{"record":{"id":"9d9b3eac76989e0a","repo":"grafana/k6","slug":"making-browser-data-directory-q-w-9d9b3e","errorCode":null,"errorMessage":"making browser data directory %q: %w","messagePattern":"making browser data directory %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/storage/storage.go","lineNumber":59,"sourceCode":"\t\treturn nil\n\t}\n\n\t// create a temporary dir because the provided dir is empty.\n\tif d.fsMkdirTemp == nil {\n\t\td.fsMkdirTemp = os.MkdirTemp //nolint:forbidigo\n\t}\n\tvar err error\n\tif d.Dir, err = d.fsMkdirTemp(tmpDir, K6BrowserDataDirPattern); err != nil {\n\t\tvar (\n\t\t\tpe   *fs.PathError\n\t\t\tpath = filepath.Join(tmpDir, K6BrowserDataDirPattern)\n\t\t)\n\t\tif errors.As(err, &pe) {\n\t\t\tpath = pe.Path\n\t\t\terr = pe.Err\n\t\t}\n\n\t\treturn fmt.Errorf(\"making browser data directory %q: %w\", path, err)\n\t}\n\td.remove = true\n\n\treturn nil\n}\n\n// Cleanup removes the temporary directory if Make was called with a non\n// empty dir argument.\n// It is named as Cleanup because it can be used for other features in the\n// future.\nfunc (d *Dir) Cleanup() error {\n\td.mu.Lock()\n\tdefer d.mu.Unlock()\n\n\tif !d.remove {\n\t\treturn nil\n\t}\n","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/storage/storage.go#L41-L77","documentation":"Raised in storage.Make when os.MkdirTemp fails to create a temporary browser data directory using the K6BrowserDataDirPattern under tmpDir (the '%q' is the attempted path, extracted from the resulting *fs.PathError). It fires when no temporary directory can be created for the browser profile: TMPDIR unwritable/nonexistent, permission denied, or out of space/inodes. Browser launch then aborts.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/storage/storage.go:59 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check TMPDIR (or pass an explicit writable dir) and its permissions","Free disk space/inodes on the temp filesystem","Verify the process user can create directories under the temp path","Avoid running with a read-only or size-limited tmpfs for browser profiles"],"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":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}