vxcontrol/pentagi · error

failed to unmarshal browser action: %w

Error message

failed to unmarshal browser action: %w

What it means

Error "failed to unmarshal browser action: %w" thrown in vxcontrol/pentagi.

Source

Thrown at backend/pkg/tools/browser.go:147

func (b *browser) Handle(ctx context.Context, name string, args json.RawMessage) (string, error) {
	if !b.IsAvailable() {
		return "", fmt.Errorf("browser is not available")
	}

	var action Browser
	logger := logrus.WithContext(ctx).WithFields(enrichLogrusFields(b.flowID, b.taskID, b.subtaskID, logrus.Fields{
		"tool": name,
		"args": string(args),
	}))

	if name != "browser" {
		logger.Error("unknown tool")
		return "", fmt.Errorf("unknown tool: %s", name)
	}

	if err := json.Unmarshal(args, &action); err != nil {
		logger.WithError(err).Error("failed to unmarshal browser action")
		return "", fmt.Errorf("failed to unmarshal browser action: %w", err)
	}

	// LLMs occasionally wrap the URL with an incidental leading/trailing
	// newline, carriage return, or space (e.g. copy-pasted from command
	// output); net/url.Parse rejects control characters outright, failing the
	// whole call over whitespace that carries no meaning. Strip it here so it
	// never reaches resolveUrl.
	action.Url = strings.TrimSpace(action.Url)

	if action.Action == "" {
		// The LLM occasionally omits the required 'action' field even though the
		// tool schema marks it required. 'markdown' is the safest default: it is
		// the most commonly used and most versatile content format, so infer it
		// instead of failing the call outright and burning a tool-call-fixer
		// round-trip on something that doesn't need one.
		action.Action = Markdown
	}

View on GitHub (pinned to ea665308ba)

When it happens

Trigger: Thrown at backend/pkg/tools/browser.go:147 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01). Data as JSON: /api/errors/1eef1846174298b7. Report an issue: GitHub.