{"record":{"id":"fddc328a0892d724","repo":"grafana/k6","slug":"logfile-configuration-should-be-in-the-form-file","errorCode":null,"errorMessage":"logfile configuration should be in the form `file=path-to-local-file` but is `%s`","messagePattern":"logfile configuration should be in the form `file=path-to-local-file` but is `(.+?)`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/log/file.go","lineNumber":50,"sourceCode":"\tbw             *bufio.Writer\n\tlevels         []logrus.Level\n}\n\n// FileHookFromConfigLine returns new fileHook hook.\nfunc FileHookFromConfigLine(\n\tfs fsext.Fs, getCwd func() (string, error),\n\tfallbackLogger logrus.FieldLogger, line string,\n) (AsyncHook, error) {\n\thook := &fileHook{\n\t\tfs:             fs,\n\t\tfallbackLogger: fallbackLogger,\n\t\tlevels:         logrus.AllLevels,\n\t\tloglines:       make(chan []byte, fileHookBufferSize),\n\t}\n\n\tlogOutput, _, _ := strings.Cut(line, \"=\")\n\tif logOutput != \"file\" {\n\t\treturn nil, fmt.Errorf(\"logfile configuration should be in the form `file=path-to-local-file` but is `%s`\", line)\n\t}\n\tif err := hook.parseArgs(line); err != nil {\n\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 {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/log/file.go#L32-L68","documentation":"A validation guard in FileHookFromConfigLine. The --log-output flag for file logging must be exactly `file=path`; it fires when the prefix before '=' is not 'file' (e.g. a malformed line or a different output type routed here). The at-fault input is the whole log-output configuration line.","triggerScenarios":"Thrown at internal/log/file.go:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the format file=path-to-local-file for --log-output","Do not pass other output kinds to the file hook; use the appropriate --log-output value (e.g. stdout, loki)","Check for typos or extra whitespace before '='"],"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-14T05:17:10.506Z"}