{"record":{"id":"fe04a692b43e7a2b","repo":"grafana/k6","slug":"filepath-must-not-be-empty","errorCode":null,"errorMessage":"filepath must not be empty","messagePattern":"filepath must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/log/file.go","lineNumber":71,"sourceCode":"\t\treturn nil, err\n\t}\n\tif err := hook.openFile(getCwd); err != nil {\n\t\treturn nil, err\n\t}\n\treturn hook, nil\n}\n\nfunc (h *fileHook) parseArgs(line string) error {\n\ttokens, err := strvals.Parse(line)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error while parsing logfile configuration %w\", err)\n\t}\n\n\tfor _, token := range tokens {\n\t\tswitch token.Key {\n\t\tcase \"file\":\n\t\t\tif token.Value == \"\" {\n\t\t\t\treturn fmt.Errorf(\"filepath must not be empty\")\n\t\t\t}\n\t\t\th.path = token.Value\n\t\tcase \"level\":\n\t\t\th.levels, err = parseLevels(token.Value)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unknown logfile config key %s\", token.Key)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// openFile opens logfile and initializes writers.\nfunc (h *fileHook) openFile(getCwd func() (string, error)) error {\n\tpath := h.path","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/log/file.go#L53-L89","documentation":"Thrown by fileHook.parseArgs in internal/log/file.go when the k6 log file hook receives a `file=` logging config option with an empty value. The parser accepts the token key but rejects an empty path because no log file could be opened; it fires during k6 startup when parsing the --log-file configuration line via FileHookFromConfigLine.","triggerScenarios":"Thrown at internal/log/file.go:71 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide an actual path after file=, e.g. --log-output=file=./k6.log","Remove the empty file= key if file logging is not intended"],"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"}