infiniflow/ragflow · critical · Error

Failed to read compilation status

Error message

Failed to read compilation status

What it means

validate_connector_settings bails out when self._creds is None — load_credentials() was never called (or failed before assigning creds) yet settings validation was invoked. ConnectorMissingCredentialError signals the lifecycle mistake to the caller/UI.

Source

Thrown at web/src/hooks/use-dataset-generate.ts:123

    retryDelay: 1000,
    enabled: open && !!id,
    queryFn: async () => {
      if (isGoDatasetBackend()) {
        // Scheduler compile-status contract (dataset-level, variant-agnostic).
        // The status is NOT a task percentage: we carry the raw state, the
        // MySQL inflight/backlog entry counts and the error diagnostic, and
        // derive the display status in useGenerateStatus. progress is only set
        // so the shared refetch/status helpers keep their contract (idle->0,
        // running/pending->0, completed->1, error->0).
        const res = await getDatasetCompilationStatus(id!);
        const data = res?.data;
        // The handler returns HTTP 200 with a non-zero business code for
        // authorization/business errors (e.g. "no authorization"). The request
        // interceptor only shows a toast and does not reject, so without this
        // explicit check a failed read would be mapped to a misleading idle
        // state. Reject so the query surfaces the error instead.
        if (!data || data.code !== 0) {
          throw new Error(data?.message || 'Failed to read compilation status');
        }
        const st = data.data ?? {};
        const state: string = st.state ?? 'idle';
        const error: string = st.error ?? '';
        return {
          progress: state === 'completed' ? 1 : state === 'idle' ? 0 : 0,
          progress_msg: error || state,
          compilationState: state,
          inflight: st.inflight ?? 0,
          backlog: st.backlog ?? 0,
          compilationError: error,
        } as ITraceInfo;
      }
      const { data } = await traceIndex(id!, traceType);
      return data?.data ?? {};
    },
  });
};

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Call load_credentials(creds_dict) successfully before validate_connector_settings()
  2. Fix the underlying credential payload error (missing primary admin key, malformed token JSON) that prevented _creds from being set
  3. Order operations: construct → load_credentials → validate_connector_settings → index

Example fix

# before
connector = GoogleDriveConnector(...)
connector.validate_connector_settings()  # boom

# after
connector = GoogleDriveConnector(...)
connector.load_credentials(credentials_dict)
connector.validate_connector_settings()
Defensive patterns

Strategy: validation

Validate before calling

def validate_ready(connector) -> bool:
    return connector._creds is not None  # via load_credentials having run

Try / catch

from common.data_source.exceptions import ConnectorMissingCredentialError

try:
    connector.validate_connector_settings()
except ConnectorMissingCredentialError:
    connector.load_credentials(load_credential_from_db(conn_id))
    connector.validate_connector_settings()

Prevention

When it happens

Trigger: Constructing GoogleDriveConnector and calling validate_connector_settings() directly without load_credentials(), or load_credentials raising earlier (e.g. error 627's missing-key ValueError) leaving _creds unset while the caller still proceeds to validate.

Common situations: UI 'Test connection' pressed before the credential JSON is saved, a previous load_credentials failure swallowed by an except-pass block, perm-sync job scheduled on a half-configured connector.

Related errors


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/4b3f10f228eceaa8. Report an issue: GitHub.