{"record":{"id":"3848a7393711d002","repo":"grafana/k6","slug":"reading-features-flag-w","errorCode":null,"errorMessage":"reading --features flag: %w","messagePattern":"reading --features flag: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/features.go","lineNumber":97,"sourceCode":"\t\tout[i] = jsonFlag{\n\t\t\tFeature:     f.Name,\n\t\t\tLifecycle:   f.Lifecycle.String(),\n\t\t\tDescription: f.Description,\n\t\t}\n\t}\n\n\tenc := json.NewEncoder(c.gs.Stdout)\n\tenc.SetIndent(\"\", \"  \")\n\treturn enc.Encode(out)\n}\n\nfunc resolveFeatureFlags(gs *state.GlobalState, cmd *cobra.Command, piState *lib.TestPreInitState) error {\n\tvar cli features.Source\n\tif cmd.Flags().Lookup(\"features\") != nil {\n\t\tcli.Supplied = cmd.Flags().Changed(\"features\")\n\t\tvals, err := cmd.Flags().GetStringArray(\"features\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"reading --features flag: %w\", err)\n\t\t}\n\t\tcli.Values = vals\n\t}\n\n\tfileConf, err := readDiskConfig(gs)\n\tif err != nil {\n\t\treturn errext.WithExitCodeIfNone(\n\t\t\tfmt.Errorf(\"failed to load the configuration file from the local file system: %w\", err),\n\t\t\texitcodes.InvalidConfig,\n\t\t)\n\t}\n\tjsonSurface := features.Source{Values: fileConf.Features, Supplied: fileConf.Features != nil}\n\n\tenvSurface := maps.Clone(gs.Env)\n\tif envSurface == nil {\n\t\tenvSurface = make(map[string]string)\n\t}\n\tmaps.Copy(envSurface, piState.RuntimeOptions.Env)","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/cmd/features.go#L79-L115","documentation":"Wrapped error from resolveFeatureFlags: reading the --features CLI flag values via pflag failed. This should not happen in normal operation — it indicates an internal flag-registration inconsistency rather than bad user input.","triggerScenarios":"Thrown at internal/cmd/features.go:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry with a correctly formatted --features FlagName[=value] argument","Report as an internal bug if the flag syntax is valid but the error persists"],"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"}