tinyhumansai/openhuman · error

RPC envelope contains undefined data

Error message

RPC envelope contains undefined data

What it means

Startup error from `openhuman subconscious tick`: `Config::load_or_init()` failed and the underlying error is appended verbatim after the colon. load_or_init reads (or creates) the workspace config and applies OPENHUMAN_* env overrides, so the appended cause is typically a TOML parse error with file/line, a filesystem/permission error on the workspace dir, or an invalid env-override value. The wrapper uses map_err with display formatting, so the original error chain is flattened into the message text.

Source

Thrown at app/src/services/api/agentProfilesApi.ts:12

import type { AgentProfile, AgentProfilesResponse } from '../../types/agentProfile';
import { callCoreRpc } from '../coreRpcClient';

interface Envelope<T> {
  data?: T;
}

function unwrapEnvelope<T>(response: Envelope<T> | T): T {
  if (response && typeof response === 'object' && 'data' in response) {
    const envelope = response as Envelope<T>;
    if (envelope.data === undefined) {
      throw new Error('RPC envelope contains undefined data');
    }
    return envelope.data;
  }
  return response as T;
}

export const agentProfilesApi = {
  list: async (): Promise<AgentProfilesResponse> => {
    const response = await callCoreRpc<Envelope<AgentProfilesResponse>>({
      method: 'openhuman.profiles_list',
    });
    return unwrapEnvelope(response);
  },

  select: async (profileId: string): Promise<AgentProfilesResponse> => {
    const response = await callCoreRpc<Envelope<AgentProfilesResponse>>({
      method: 'openhuman.profiles_select',
      params: { profile_id: profileId },

View on GitHub (pinned to a221052e0d)

Solutions

  1. Read the text after 'config load failed:' — it names the actual cause and, for TOML errors, the file and line to fix
  2. Check the workspace dir is readable+writable by the process user (default ~/.openhuman; or the path passed via --workspace / OPENHUMAN_WORKSPACE)
  3. Validate the config file parses as TOML before retrying (e.g. `python3 -c "import tomllib,sys; tomllib.load(open(sys.argv[1],'rb'))" <file>`)
  4. Bisect a corrupt workspace from an environment problem: `openhuman subconscious tick --workspace /tmp/fresh-ws`

Example fix

# before: config load failed: expected equals, found newline at line 12
#   (broken hand edit in the workspace config.toml)
# after: fix line 12 quoting, or start clean:
openhuman subconscious tick --workspace /tmp/fresh-ws
Defensive patterns

Strategy: try-catch

Validate before calling

# bash: pre-flight the workspace before ticking
ws="${OPENHUMAN_WORKSPACE:-$HOME/.openhuman}"
[ -d "$ws" ] || mkdir -p "$ws" 2>/dev/null || { echo "workspace not writable: $ws" >&2; exit 2; }
[ -w "$ws" ] || { echo "workspace not writable: $ws" >&2; exit 2; }
cfg=$(find "$ws" -maxdepth 2 -name '*.toml' | head -1)
[ -z "$cfg" ] || python3 -c "import tomllib,sys; tomllib.load(open(sys.argv[1],'rb'))" "$cfg" 2>/dev/null || { echo "config TOML invalid: $cfg" >&2; exit 2; }

Try / catch

# Rust caller: the anyhow context flattens the chain, so match on the message prefix
match run_subconscious_command(&args) {
    Err(e) if e.to_string().starts_with("config load failed:") => {
        eprintln!("config/workspace problem — fix the cause after the colon, or tick a fresh --workspace");
        std::process::exit(78); // EX_CONFIG
    }
    other => other,
}

Prevention

When it happens

Trigger: Hand-edited config.toml with broken quoting/syntax (cause shows the line); workspace directory (default ~/.openhuman, or your --workspace) unwritable — read-only volume, wrong owner, disk full; a malformed OPENHUMAN_* env override that fails schema parsing; partial/corrupt write from a crash during config migration.

Common situations: First run inside a container with no writable HOME; editing config with an editor that changed quoting; a version upgrade that partially migrated config schema; --workspace pointing at a path that cannot be created.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16). Data as JSON: /api/errors/e5a110a8916314e1. Report an issue: GitHub.