{"record":{"id":"1a220e7b5a7a34aa","repo":"golang/go","slug":"no-engine-configured","errorCode":null,"errorMessage":"no engine configured","messagePattern":"no engine configured","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/script/cmds.go","lineNumber":733,"sourceCode":"\t\ts.Logf(\"matched: %s\\n\", lines)\n\t}\n\treturn nil\n}\n\n// Help writes command documentation to the script log.\nfunc Help() Cmd {\n\treturn Command(\n\t\tCmdUsage{\n\t\t\tSummary: \"log help text for commands and conditions\",\n\t\t\tArgs:    \"[-v] name...\",\n\t\t\tDetail: []string{\n\t\t\t\t\"To display help for a specific condition, enclose it in brackets: 'help [amd64]'.\",\n\t\t\t\t\"To display complete documentation when listing all commands, pass the -v flag.\",\n\t\t\t},\n\t\t},\n\t\tfunc(s *State, args ...string) (WaitFunc, error) {\n\t\t\tif s.engine == nil {\n\t\t\t\treturn nil, errors.New(\"no engine configured\")\n\t\t\t}\n\n\t\t\tverbose := false\n\t\t\tif len(args) > 0 {\n\t\t\t\tverbose = true\n\t\t\t\tif args[0] == \"-v\" {\n\t\t\t\t\targs = args[1:]\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar cmds, conds []string\n\t\t\tfor _, arg := range args {\n\t\t\t\tif strings.HasPrefix(arg, \"[\") && strings.HasSuffix(arg, \"]\") {\n\t\t\t\t\tconds = append(conds, arg[1:len(arg)-1])\n\t\t\t\t} else {\n\t\t\t\t\tcmds = append(cmds, arg)\n\t\t\t\t}\n\t\t\t}","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/script/cmds.go#L715-L751","documentation":"Returned by the script Help command when s.engine is nil. Help needs the Engine to enumerate registered commands and conditions and print their usage, so running it on a State that was not initialized through an Engine (or whose engine reference was not set) is rejected. It indicates the script environment was wired up incorrectly rather than a user script typo.","triggerScenarios":"Calling the Help command in a script run against a State that has no Engine attached — e.g. a State constructed manually for a test, or a custom Cmd injected without going through Engine.Params/Run. Help unconditionally dereferences s.engine and refuses first if it is nil.","commonSituations":"Writing a custom script-test harness that builds its own State instead of using Engine.Run, then exercising the built-in Help command. Registering Help in a Cmds map but forgetting to construct it through an Engine.","solutions":["Run scripts through an Engine: construct Engine{Cmds:..., Conds:...} and call engine.Run(scripttest.TestMain(...)) so State.engine is populated.","If you must use a bare State, set s.engine to your Engine before invoking Help, or skip registering Help.","Replace the built-in Help with a custom command that does not require the engine, if you only need static help text."],"exampleFix":"// before: manual State, Help fails\nst := &script.State{}\nst.Run(impls, []string{\"help\"}) // -> \"no engine configured\"\n\n// after: drive through an Engine\neng := &script.Engine{Cmds: script.DefaultCmds(), Conds: script.DefaultConds()}\neng.Run(st, \"help\")","handlingStrategy":"validation","validationCode":"// Ensure an Engine is attached to the State before running scripts.\nfunc ensureEngine(st *script.State, eng *script.Engine) {\n    if st.Engine == nil { // set the field if exposed; otherwise construct via Engine.Run\n        st.Engine = eng\n    }\n}","typeGuard":"func isNoEngine(err error) bool {\n    return err != nil && err.Error() == \"no engine configured\"\n}","tryCatchPattern":"// Avoid the path entirely: run scripts through Engine.Run so State.engine is set.","preventionTips":["Always drive scripts through an Engine, not a bare State.","If you register the built-in Help, you must have an Engine.","Provide a custom Help command if your harness lacks an Engine."],"tags":["script","test-framework","engine","help"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T11:17:21.771Z"}