{"record":{"id":"0750cd03b5fa7d0f","repo":"JuliusBrussee/caveman","slug":"unknown-action-s","errorCode":null,"errorMessage":"unknown action: %s","messagePattern":"unknown action: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"browse/cdp.go","lineNumber":220,"sourceCode":"\t\t\toption = req.Text\n\t\t}\n\t\tif option == \"\" {\n\t\t\treturn ActionResult{OK: false, Settled: false}, errors.New(\"select: missing option\")\n\t\t}\n\t\tif err := d.callOnNode(runCtx, target, fmt.Sprintf(`function(){ const wanted = %s; const options = Array.from(this.options || []); const match = options.find(o => o.value === wanted || o.label === wanted || o.textContent.trim() === wanted); if (!match) { throw new Error(\"option not found\"); } this.value = match.value; this.dispatchEvent(new Event(\"input\", {bubbles:true})); this.dispatchEvent(new Event(\"change\", {bubbles:true})); return true; }`, jsString(option))); err != nil {\n\t\t\treturn ActionResult{OK: false, Settled: false}, err\n\t\t}\n\t\treturn dispatchedAction(), nil\n\tcase \"scroll\":\n\t\tif err := d.scrollIntoView(runCtx, target); err != nil {\n\t\t\treturn ActionResult{OK: false, Settled: false}, err\n\t\t}\n\t\tif _, _, err := d.waitActionable(runCtx, target); err != nil {\n\t\t\treturn ActionResult{OK: false, Settled: false}, err\n\t\t}\n\t\treturn dispatchedAction(), nil\n\tdefault:\n\t\treturn ActionResult{OK: false, Settled: false}, fmt.Errorf(\"unknown action: %s\", req.Action)\n\t}\n}\n\nfunc dispatchedAction() ActionResult {\n\t// CDP acknowledged dispatch, but asynchronous application state may still be\n\t// changing. Claiming settled=true here made agents trust an unverified result.\n\t// A focused browser_snapshot is the cheap, evidence-bearing verification step.\n\treturn ActionResult{OK: true, Settled: false, Note: \"dispatched; resnapshot to verify\"}\n}\n\nfunc (d *CDPDriver) scrollIntoView(ctx context.Context, target Target) error {\n\treturn d.callOnNode(ctx, target, `function(){ this.scrollIntoView({block:\"center\", inline:\"center\", behavior:\"instant\"}); return true; }`)\n}\n\n// Shutdown closes the attached browser process. Ordinary Close only releases\n// this driver context; direct CLI mode deliberately leaves its detached Chrome\n// alive between snapshot and act commands until `browse close` calls Shutdown.\nfunc (d *CDPDriver) Shutdown(ctx context.Context) error {","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/browse/cdp.go#L202-L238","documentation":"CDPDriver.Act dispatches a browser interaction (click, fill, etc.) keyed by req.Action. Any action name outside the switch's known cases is rejected with 'unknown action: %s', returning an unsuccessful ActionResult rather than guessing.","triggerScenarios":"Calling Act with an ActionResult request whose Action string is not one of the driver's supported verbs — e.g. a typo ('clik'), a casing mismatch ('Click'), or an action supported by another driver backend but not the CDP driver.","commonSituations":"Agent-generated action plans containing hallucinated or unsupported action names; a driver abstraction shared across backends where one backend supports actions the CDP driver does not; schema drift after the action vocabulary changed upstream.","solutions":["Print/log req.Action and compare it against the supported cases in Act's switch (browse/cdp.go) and use an exact supported action name","Fix casing/typos in the action producer (LLM prompt, planner, or mapping table) so it emits only supported verbs","If the action is legitimately new, implement its case in Act rather than reusing the string ad hoc"],"exampleFix":"// before\nreq := browse.ActionRequest{Action: \"Click\", ...}   // wrong casing\n// after\nreq := browse.ActionRequest{Action: \"click\", ...}   // matches a case in Act's switch","handlingStrategy":"validation","validationCode":"var supportedActions = map[string]bool{\"click\": true, \"fill\": true /* see Act's switch */}\nif !supportedActions[action] {\n\treturn fmt.Errorf(\"unsupported action %q for cdp driver\", action)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Define the action vocabulary as a shared typed enum/constants used by both planner and driver","Constrain LLM/planner output with a schema that only allows known action names","Add a unit test asserting every planner-emitted action is accepted by each driver backend"],"tags":["go","browser","cdp","invalid-enum-value","automation"],"backgroundTag":"invalid-enum-value","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}