vxcontrol/pentagi · error · FatalError

request failed

Error message

request failed

What it means

When the decoded 200-body has success=false but an empty Error field, firecrawl still cannot produce results and returns the bare Fatal 'request failed'. It is a catch-all for an unsuccessful but undescribed engine response.

Source

Thrown at backend/pkg/tools/searchers/firecrawl.go:185

		return "", Retryable(fmt.Errorf("failed to do request: %v", err), 0)
	}
	defer resp.Body.Close()

	return f.parseHTTPResponse(ctx, query, resp)
}

func (f *firecrawl) parseHTTPResponse(ctx context.Context, query string, resp *http.Response) (string, error) {
	switch resp.StatusCode {
	case http.StatusOK:
		var respBody firecrawlSearchResult
		if err := json.NewDecoder(resp.Body).Decode(&respBody); err != nil {
			return "", Fatal(fmt.Errorf("failed to decode response body: %v", err))
		}
		if !respBody.Success {
			if respBody.Error != "" {
				return "", Fatal(fmt.Errorf("request failed: %s", respBody.Error))
			}
			return "", Fatal(fmt.Errorf("request failed"))
		}
		return f.buildFirecrawlResult(ctx, query, &respBody), nil
	case http.StatusBadRequest:
		return "", Fatal(fmt.Errorf("request is invalid"))
	case http.StatusUnauthorized:
		return "", Fatal(fmt.Errorf("API key is wrong"))
	case http.StatusPaymentRequired:
		return "", Fatal(fmt.Errorf("insufficient credits to perform this request"))
	case http.StatusForbidden:
		return "", Fatal(fmt.Errorf("the endpoint requested is hidden for administrators only"))
	case http.StatusNotFound:
		return "", Fatal(fmt.Errorf("the specified endpoint could not be found"))
	case http.StatusMethodNotAllowed:
		return "", Fatal(fmt.Errorf("there need to try to access an endpoint with an invalid method"))
	case http.StatusRequestTimeout:
		return "", Retryable(fmt.Errorf("the request timed out. try again later"), 0)
	case http.StatusTooManyRequests:
		return "", Retryable(fmt.Errorf("there are requesting too many results"), 0)

View on GitHub (pinned to ea665308ba)

Solutions

  1. Check the Firecrawl API version supported by this codebase vs your instance; align versions.
  2. Log the full response body to capture fields the struct may be missing.
  3. If self-hosted, upgrade the Firecrawl instance to a version matching /v2 semantics.
  4. Use a fallback engine while investigating.

Example fix

// before: struct misses new fields
Error string `json:"error"`
// after
codec, _ := io.ReadAll(resp.Body); log.Debugf("raw: %s", codec) // inspect real shape, then extend struct
Defensive patterns

Strategy: fallback

Validate before calling

// verify engine contract with a probe query
var probe firecrawlSearchResult
if err := json.NewDecoder(resp.Body).Decode(&probe); err == nil && !probe.Success && probe.Error == "" {
  return errors.New("engine contract violation: success=false without error")
}

Prevention

When it happens

Trigger: Firecrawl returns HTTP 200 with {"success":false} and no error text — contract violation or empty job result path.

Common situations: New/changed Firecrawl API version emitting a different failure shape, self-hosted instance returning bare failures, proxy stripping the error field.

Related errors


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