ruvnet/RuView · error · TypeError

guidance options must be an object

Error message

guidance options must be an object

What it means

Raised at auth.py:273 when the token's user exists but user.get('is_active') is falsy. User records carry an is_active flag; create_user sets it True, but any flow that sets it False (deactivation) makes all subsequent authenticated requests fail even with a perfectly valid JWT.

Source

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

    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;
  if (!GUIDANCE_TOPICS.includes(topic)) {
    throw new RangeError(`unsupported guidance topic: ${topic}`);
  }

View on GitHub (pinned to 4685618388)

Solutions

  1. Reactivate the account: set user['is_active'] = True in the user store
  2. When importing users, guarantee the field is a real boolean True
  3. Have the client fall back to login - note login also fails for inactive users, so reactivation is the only path

Example fix

# before
user_manager._users['alice']['is_active'] = False
# after
user_manager._users['alice']['is_active'] = True
Defensive patterns

Strategy: try-catch

Validate before calling

def user_is_usable(user_manager, username: str) -> bool:
    """Both conditions _authenticate_request checks after lookup."""
    user = user_manager.get_user(username)
    return user is not None and bool(user.get("is_active", False))

Type guard

def is_active_user(user: dict) -> bool:
    return isinstance(user, dict) and user.get("is_active") is True and "roles" in user

Try / catch

try:
    user_info = await middleware._authenticate_request(request)
except AuthenticationError as e:
    if str(e) == "User account is disabled":
        return json_response({"error": "account disabled; contact admin"}, 403)
    raise

Prevention

When it happens

Trigger: An admin deactivates a user (is_active=False) while their token is still unexpired; user records loaded from external data with is_active missing or 0/None; tests toggling is_active and forgetting to restore.

Common situations: Account bans/suspensions taking effect; data migration writing is_active as 0 instead of True; JSON configs where is_active is absent so .get() defaults to False.

Related errors


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