projectdiscovery/katana · error
unknown action type: %v
Error message
unknown action type: %v
What it means
dispatchCrawlAction switches on action.Type to execute the requested crawl action (click, navigate, wait, etc.). If an action's Type is not one of the handled constants, the default branch returns this error naming the raw type value. It means the crawler encountered an action definition it does not know how to execute.
Source
Thrown at pkg/engine/headless/crawler/crawler.go:551
if err != nil {
var ce *rod.CoveredError
if errors.As(err, &ce) {
return ErrElementNotVisible
}
return err
}
if interactable == nil {
return ErrElementNotVisible
}
if err := element.Click(proto.InputMouseButtonLeft, 1); err != nil {
return err
}
if err = page.WaitPageLoadHeurisitics(); err != nil {
return err
}
default:
return fmt.Errorf("unknown action type: %v", action.Type)
}
return nil
}
func (c *Crawler) tryAutoLogin(page *browser.BrowserPage, html string) bool {
pageResult, err := c.options.DitClassifier.ExtractPageType(html)
if err != nil || pageResult == nil {
return false
}
for _, form := range pageResult.Forms {
if form.Type != "login" {
continue
}
pageURL := ""
if info, err := page.Info(); err == nil {View on GitHub (pinned to e3e742739c)
Solutions
- Log action.Type and compare with the supported action constants in the headless crawler package
- Fix the action definition in your crawl config (typo/renamed type)
- Upgrade katana to a version that supports the action type you need
- Filter or skip unknown actions before dispatching if you build action lists dynamically
Example fix
// before
actions := []{ {Type: "hover"} } // not supported by this version
// after
actions := []{ {Type: "click"} } // use a supported action type Defensive patterns
Strategy: validation
Validate before calling
supportedActions := map[ActionType]bool{ActionClick: true, ActionNavigate: true, ActionWait: true /* ...supported set */}
for _, a := range actions {
if !supportedActions[a.Type] {
return fmt.Errorf("dropping unsupported crawl action %v", a.Type)
}
} Prevention
- Validate action lists against supported types before crawling
- Keep action definitions and katana version in sync
- Use named constants, not raw strings/ints, when building actions programmatically
- Log and skip unknown actions instead of failing the whole crawl
When it happens
Trigger: An action record carries a Type outside the known enum — e.g. from a custom action list, an outdated/renamed enum value, or a caller constructing actions programmatically with an invalid/zero Type.
Common situations: Custom crawl-action configuration referencing a type unsupported by this katana version; schema evolution where a new action type was added in config before the engine was upgraded; a typo'd action type string/constant.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- ErrOutOfScope
- ErrMaxDepthReached
- ErrNoCrawlingAction
- captcha inject: %w
- failed to get origin page state: %w
AI-assisted analysis of projectdiscovery/katana@e3e742739c (2026-09-03).
Data as JSON: /api/errors/35a77af963c54110.
Report an issue: GitHub.