ruvnet/RuView · error · TypeError

guidance input must be an object

Error message

guidance input must be an object

What it means

Raised at auth.py:270 when the JWT verifies fine but UserManager.get_user(sub) returns None - the username in the sub claim is not in the in-memory self._users dict. UserManager creates no default users and stores nothing persistently, so the store is empty after every process restart.

Source

Thrown at harness/homecore/src/guidance.js:54

  for (const term of wanted) {
    if (idAndName.has(term)) score += 5;
    else if (topics.has(term)) score += 3;
    else if (full.has(term)) score += 1;
  }
  return score;
}

function unique(values) {
  return [...new Set(values)];
}

export function listGuidanceTopics() {
  return GUIDANCE_TOPICS.map((topic) => ({ topic, summary: TOPIC_SUMMARIES[topic] }));
}

export function getGuidance(input = {}, options = {}) {
  if (!input || typeof input !== 'object' || Array.isArray(input)) {
    throw new TypeError('guidance input must be an object');
  }
  if (!options || typeof options !== 'object' || Array.isArray(options)) {
    throw new TypeError('guidance options must be an object');
  }
  if (input.topic !== undefined && typeof input.topic !== 'string') {
    throw new TypeError('guidance topic must be a string');
  }
  if (input.query !== undefined && typeof input.query !== 'string') {
    throw new TypeError('guidance query must be a string');
  }
  if (input.limit !== undefined && (typeof input.limit !== 'number' || !Number.isFinite(input.limit))) {
    throw new TypeError('guidance limit must be a finite number');
  }
  if (options.repoRoot !== undefined && options.repoRoot !== null && typeof options.repoRoot !== 'string') {
    throw new TypeError('guidance repoRoot must be a string or null');
  }

  const topic = input.topic === undefined ? 'overview' : input.topic;

View on GitHub (pinned to 4685618388)

Solutions

  1. Re-register the user via create_user / the register endpoint, then log in again to get a token whose sub resolves
  2. If restarts keep losing users, provision users at startup (seed script) or back UserManager with persistent storage
  3. For multi-instance deployments, share the user store or ensure sticky sessions
Defensive patterns

Strategy: try-catch

Validate before calling

def token_user_exists(token_manager, user_manager, token: str) -> bool:
    """True when the token verifies AND its sub resolves to a stored user."""
    claims = token_manager.decode_token_claims(token)
    if claims is None:
        return False
    return user_manager.get_user(claims.get("sub", "")) is not None

Try / catch

try:
    user_info = await middleware._authenticate_request(request)
except AuthenticationError as e:
    if str(e) == "User not found":
        # store was reset or user deleted -> force full re-auth
        clear_client_token()
        return json_response({"error": "re-login required"}, 401)
    raise

Prevention

When it happens

Trigger: Server restart: a valid token from before the restart names a user that no longer exists in the fresh empty dict; user was never created via create_user; token issued for a user of another instance/environment; user deleted.

Common situations: Dev server auto-reload (uvicorn --reload) wiping registered users mid-session; tokens persisted in a client across server restarts; load-balanced instances where registration happened on instance A but the request hits instance B; assuming seed/admin users exist when the code deliberately provisions none.

Related errors


AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16). Data as JSON: /api/errors/99feaba3773522c4. Report an issue: GitHub.