{"record":{"id":"35d81909dbc99a0c","repo":"sipeed/picoclaw","slug":"invalid-eval-mode-q-must-be-token-or-llm","errorCode":null,"errorMessage":"invalid --eval-mode %q: must be token or llm","messagePattern":"invalid --eval-mode %q: must be token or llm","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/membench/main.go","lineNumber":201,"sourceCode":"\n\tif flagLimit > 0 {\n\t\tfor i := range samples {\n\t\t\tif len(samples[i].QA) > flagLimit {\n\t\t\t\tsamples[i].QA = samples[i].QA[:flagLimit]\n\t\t\t}\n\t\t}\n\t\tlog.Printf(\"Limited to %d QA per sample\", flagLimit)\n\t}\n\n\tevalMode := strings.ToLower(strings.TrimSpace(flagEvalMode))\n\tvar useLLM bool\n\tswitch evalMode {\n\tcase \"token\":\n\t\tuseLLM = false\n\tcase \"llm\":\n\t\tuseLLM = true\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid --eval-mode %q: must be token or llm\", flagEvalMode)\n\t}\n\tvar answerClient, judgeClient *LLMClient\n\tif useLLM {\n\t\topts, err := buildLLMOptions()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tanswerClient = NewLLMClient(opts)\n\t\tjudgeClient = answerClient // default: same client\n\t\tif flagJudgeModel != \"\" {\n\t\t\tjOpts := opts // copy base settings\n\t\t\tjOpts.Model = flagJudgeModel\n\t\t\tif flagJudgeAPIBase != \"\" {\n\t\t\t\tjOpts.BaseURL = flagJudgeAPIBase\n\t\t\t}\n\t\t\tif flagJudgeAPIKey != \"\" {\n\t\t\t\tjOpts.APIKey = flagJudgeAPIKey\n\t\t\t}","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/membench/main.go#L183-L219","documentation":"Validation guard in runEval after normalizing flagEvalMode: the --eval-mode value matched neither 'token' nor 'llm' (case-insensitive, whitespace-trimmed), so the evaluator mode is undefined. The %q shows the raw flag value the user supplied; firing before any clients are built, it prevents running the eval with an ambiguous scoring mode.","triggerScenarios":"Thrown at cmd/membench/main.go:201 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set --eval-mode to exactly token or llm","Check for typos and stray characters/quotes in the flag value","Add the allowed values to the flag usage string so cobra help documents them"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","contentChangedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}