{"record":{"id":"8a2538360ff995f7","repo":"ruvnet/RuView","slug":"guidance-options-must-be-an-object","errorCode":null,"errorMessage":"guidance options must be an object","messagePattern":"guidance options must be an object","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"harness/homecore/src/guidance.js","lineNumber":57,"sourceCode":"    else if (full.has(term)) score += 1;\n  }\n  return score;\n}\n\nfunction unique(values) {\n  return [...new Set(values)];\n}\n\nexport function listGuidanceTopics() {\n  return GUIDANCE_TOPICS.map((topic) => ({ topic, summary: TOPIC_SUMMARIES[topic] }));\n}\n\nexport function getGuidance(input = {}, options = {}) {\n  if (!input || typeof input !== 'object' || Array.isArray(input)) {\n    throw new TypeError('guidance input must be an object');\n  }\n  if (!options || typeof options !== 'object' || Array.isArray(options)) {\n    throw new TypeError('guidance options must be an object');\n  }\n  if (input.topic !== undefined && typeof input.topic !== 'string') {\n    throw new TypeError('guidance topic must be a string');\n  }\n  if (input.query !== undefined && typeof input.query !== 'string') {\n    throw new TypeError('guidance query must be a string');\n  }\n  if (input.limit !== undefined && (typeof input.limit !== 'number' || !Number.isFinite(input.limit))) {\n    throw new TypeError('guidance limit must be a finite number');\n  }\n  if (options.repoRoot !== undefined && options.repoRoot !== null && typeof options.repoRoot !== 'string') {\n    throw new TypeError('guidance repoRoot must be a string or null');\n  }\n\n  const topic = input.topic === undefined ? 'overview' : input.topic;\n  if (!GUIDANCE_TOPICS.includes(topic)) {\n    throw new RangeError(`unsupported guidance topic: ${topic}`);\n  }","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/harness/homecore/src/guidance.js#L39-L75","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Reactivate the account: set user['is_active'] = True in the user store","When importing users, guarantee the field is a real boolean True","Have the client fall back to login - note login also fails for inactive users, so reactivation is the only path"],"exampleFix":"# before\nuser_manager._users['alice']['is_active'] = False\n# after\nuser_manager._users['alice']['is_active'] = True","handlingStrategy":"try-catch","validationCode":"def user_is_usable(user_manager, username: str) -> bool:\n    \"\"\"Both conditions _authenticate_request checks after lookup.\"\"\"\n    user = user_manager.get_user(username)\n    return user is not None and bool(user.get(\"is_active\", False))","typeGuard":"def is_active_user(user: dict) -> bool:\n    return isinstance(user, dict) and user.get(\"is_active\") is True and \"roles\" in user","tryCatchPattern":"try:\n    user_info = await middleware._authenticate_request(request)\nexcept AuthenticationError as e:\n    if str(e) == \"User account is disabled\":\n        return json_response({\"error\": \"account disabled; contact admin\"}, 403)\n    raise","preventionTips":["Write is_active as boolean True in imports/migrations","Admin toggles should also revoke the user's live tokens","Surface account state in login responses to avoid confusion"],"tags":["auth","user-management","accounts"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}