Skip to content

DataForSEO account-level errors (40104 unverified) surface as "An unexpected error occurred" #305

Description

@eduyubero

A fresh self-host install whose DataForSEO account is not yet verified fails every research request with:

An unexpected error occurred. Please check server logs and try again.

The real cause is a DataForSEO account-level status code that is entirely user-actionable:

status_code: 40104
status_message: "Please verify your account before using the API.
                 You can complete verification in the user panel: https://app.dataforseo.com/"
cost: $0

Why it's hard to diagnose

Two separate places drop the message:

  1. UIassertOk (src/server/lib/dataforseo/envelope.ts:225-230) does preserve status_message, but with no matching classifier it becomes AppError("INTERNAL_ERROR", …), which renders as the generic text above.
  2. Logs — the Worker error event contained only server.function error: followed by a minified stack, with no message. So the server logs the UI tells you to check don't contain the reason either.

grep -rn "40104" src/ returns nothing.

The existing createDataforseoBillingClassifier (src/server/lib/dataforseoBillingClassification.ts) covers 40200/40210/402 and only when the request path matches a configured pathPrefix (/backlinks/, AI Optimization), so /dataforseo_labs/ and /keywords_data/ calls get no classification at all.

Impact

This is a day-one blocker for new self-hosters: the DataForSEO signup flow hands you working credentials before the account is verified, and /v3/appendix/user_data succeeds in that state — so the key validates fine while every data endpoint returns 40104. Diagnosing it currently requires reproducing the API call by hand outside the app.

Suggested direction

Classify DataForSEO account-level status codes independently of pathPrefix and surface status_message for them, so 40104 (unverified) and 40200 (insufficient balance) render as themselves. Including the message in the error log would also help — the current log gives a stack but no reason.

Environment

  • Self-host on Cloudflare Workers, OpenSEO 0.1.7
  • Reproduced via Keyword Research (/v3/dataforseo_labs/google/related_keywords/live); the same 40104 applies account-wide

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions