{"record":{"id":"7e79a61617f47461","repo":"golang/go","slug":"unknown-condition-prefix-q","errorCode":null,"errorMessage":"unknown condition prefix %q","messagePattern":"unknown condition prefix %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/script/engine.go","lineNumber":735,"sourceCode":"//\n// Each of the tag arguments should be a condition string of\n// the form \"name\" or \"name:suffix\". If no tags are passed as\n// arguments, ListConds lists all conditions registered in\n// the engine e.\nfunc (e *Engine) ListConds(w io.Writer, s *State, tags ...string) error {\n\tif tags == nil {\n\t\ttags = make([]string, 0, len(e.Conds))\n\t\tfor name := range e.Conds {\n\t\t\ttags = append(tags, name)\n\t\t}\n\t\tsort.Strings(tags)\n\t}\n\n\tfor _, tag := range tags {\n\t\tif prefix, suffix, ok := strings.Cut(tag, \":\"); ok {\n\t\t\tcond := e.Conds[prefix]\n\t\t\tif cond == nil {\n\t\t\t\treturn fmt.Errorf(\"unknown condition prefix %q\", prefix)\n\t\t\t}\n\t\t\tusage := cond.Usage()\n\t\t\tif !usage.Prefix {\n\t\t\t\treturn fmt.Errorf(\"condition %q cannot be used with a suffix\", prefix)\n\t\t\t}\n\n\t\t\tactiveStr := \"\"\n\t\t\tif s != nil {\n\t\t\t\tif active, _ := cond.Eval(s, suffix); active {\n\t\t\t\t\tactiveStr = \" (active)\"\n\t\t\t\t}\n\t\t\t}\n\t\t\t_, err := fmt.Fprintf(w, \"[%s]%s\\n\\t%s\\n\", tag, activeStr, usage.Summary)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\t}","sourceCodeStart":717,"sourceCodeEnd":753,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/script/engine.go#L717-L753","documentation":"Thrown by Engine.ListConds when one of the tag arguments contains a colon but the prefix is not in e.Conds (engine.go:732-736). Unlike conditionsActive's variant (1304), this message does not append the list of known conditions. ListConds is the function behind the script 'help'-style listing of conditions.","triggerScenarios":"Calling engine.ListConds(w, s, \"UNKNOWN:suffix\") where UNKNOWN is unregistered; passing a typo'd prefix to the listing helper.","commonSituations":"Programmatic call to ListConds with an invalid tag; condition unregistered in the engine passed to ListConds; refactoring that renamed a condition without updating callers.","solutions":["Pass only registered condition tags to ListConds, or pass no tags to list all.","Register the missing condition in e.Conds before listing.","Validate tags against maps.Keys(e.Conds) before calling ListConds."],"exampleFix":"// before\nengine.ListConds(w, s, \"GOOSX:linux\")\n// after\nengine.ListConds(w, s, \"GOOS:linux\")","handlingStrategy":"validation","validationCode":"import \"maps\"\n\nfunc validateListCondsTags(conds map[string]script.Cond, tags []string) error {\n    for _, tag := range tags {\n        if prefix, _, ok := strings.Cut(tag, \":\"); ok {\n            if _, ok := conds[prefix]; !ok {\n                return fmt.Errorf(\"unknown condition prefix %q; known: %v\", prefix, maps.Keys(conds))\n            }\n        } else if _, ok := conds[tag]; !ok {\n            return fmt.Errorf(\"unknown condition %q; known: %v\", tag, maps.Keys(conds))\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass no tags to ListConds to dump all valid names before guessing.","Validate tags against e.Conds before listing."],"tags":["go-script-test","conditions","go-toolchain"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}