tinyhumansai/openhuman · error

${LOG} fallback budget read failed kind=${errorKind(err)}

Error message

${LOG} fallback budget read failed kind=${errorKind(err)}

What it means

Degraded-path warning in useEmbeddingBudgetState: for a managed user whose provider budget read came back empty, a fallback creditsApi.getTeamUsage() call failed (kind-classified in the message). The hook clears fallbackUsage to null and continues — the budget indicator is hidden rather than wrong; embedding features still work.

Source

Thrown at app/src/hooks/useEmbeddingBudgetState.ts:206

        // while `useUsageState`'s own request is still in flight, so gate on
        // `!usageLoading` too — otherwise a normal managed user whose provider
        // read resolves first fires a redundant `getTeamUsage()` that
        // `useUsageState` is about to make anyway.
        if (managed && !hasUsage && !usageLoading) {
          console.debug(`${LOG} fallback budget read start (managed + usage settled empty)`);
          try {
            const usage = await creditsApi.getTeamUsage();
            if (!cancelled) setFallbackUsage(deriveBudget(usage));
            console.debug(`${LOG} fallback budget read ok`);
          } catch (err) {
            // Auth-expired is handled globally by coreRpcClient; any failure
            // here just means "no budget data", so stay silent rather than
            // guess. Never manufacture a warning from a failed read.
            if (err instanceof CoreRpcError && err.kind === 'auth_expired') {
              console.debug(`${LOG} fallback budget read skipped: session expired`);
              if (!cancelled) setFallbackUsage(null);
            } else {
              console.warn(`${LOG} fallback budget read failed kind=${errorKind(err)}`);
              if (!cancelled) setFallbackUsage(null);
            }
          }
        } else if (!cancelled) {
          // Not needed (BYO/local, or `useUsageState` already has the figure).
          console.debug(
            `${LOG} fallback budget read not needed ` +
              `(managed=${managed} hasUsage=${hasUsage} usageLoading=${usageLoading})`
          );
          setFallbackUsage(null);
        }
      } catch (err) {
        // Conservative on failure: an unknown provider is treated as
        // NOT managed, so a transient RPC error can never manufacture a
        // budget warning for a user who funds their own embeddings.
        console.warn(`${LOG} provider read failed kind=${errorKind(err)} — treating as unmanaged`);
        if (!cancelled) {
          setProvider(null);

View on GitHub (pinned to 7491200858)

Solutions

  1. Treat as soft-degradation: hide the budget UI, don't block embedding usage
  2. Check backend session validity if the failure is persistent (401 kind)
  3. Retry the team-usage read on next mount/reconnect instead of caching the failure
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at app/src/hooks/useEmbeddingBudgetState.ts:206 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/38682489cb86ea55. Report an issue: GitHub.