{"record":{"id":"90a8145e8463eb67","repo":"ruvnet/RuView","slug":"guidance-query-must-be-a-string","errorCode":null,"errorMessage":"guidance query must be a string","messagePattern":"guidance query must be a string","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"harness/homecore/src/guidance.js","lineNumber":63,"sourceCode":"  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  }\n  const query = input.query === undefined ? '' : input.query.trim();\n  if (query && (query.length < 2 || query.length > 500)) {\n    throw new RangeError('guidance query must contain 2..500 characters');\n  }\n  const rawLimit = input.limit === undefined ? 20 : input.limit;\n  if (rawLimit < 1 || rawLimit > 20) {","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/harness/homecore/src/guidance.js#L45-L81","documentation":"Raised by AuthenticationMiddleware.login (auth.py:305) when UserManager.authenticate_user returns None. That happens for three distinct causes that are deliberately indistinguishable to callers: unknown username, bcrypt password verification failure, or the user being inactive (is_active falsy).","triggerScenarios":"POST login with a username not in self._users (fresh process, never registered); wrong password; user exists with correct password but is_active=False; typo'd or URL-encoded credentials.","commonSituations":"Server restarted and in-memory users vanished, so every login fails with this message; user registered on a different instance; password changed elsewhere; copy-paste including whitespace in username/password.","solutions":["Confirm the user exists in this process: user_manager.get_user(name) is not None","Re-register the user if the store was wiped by a restart","Verify the password matches the one used at create_user and check is_active is True","Strip whitespace from form inputs before submitting"],"exampleFix":"# before\nresp = await middleware.login(\"alice\", \"hunter2\")\n# after\nif user_manager.get_user(\"alice\") is None:\n    user_manager.create_user(\"alice\", \"a@b.c\", \"hunter2\")\nresp = await middleware.login(\"alice\", \"hunter2\")","handlingStrategy":"try-catch","validationCode":"def login_should_succeed(user_manager, username: str, password: str) -> bool:\n    \"\"\"Mirrors authenticate_user's three checks without calling login().\"\"\"\n    user = user_manager.get_user(username)\n    if user is None:\n        return False\n    from src.middleware.auth import pwd_context\n    return pwd_context.verify(password, user[\"hashed_password\"]) and bool(user.get(\"is_active\", False))","typeGuard":null,"tryCatchPattern":"from src.middleware.auth import AuthenticationError\n\ntry:\n    result = await middleware.login(username, password)\nexcept AuthenticationError as e:\n    if str(e) == \"Invalid username or password\":\n        # unknown user, wrong password, or inactive -- all identical by design\n        raise HTTPException(401, \"Invalid username or password\")\n    raise","preventionTips":["Register users before login tests; remember restarts wipe the store","Keep the identical-message behavior - do not leak which factor failed","Strip inputs client-side to avoid phantom whitespace failures"],"tags":["auth","login","credentials"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}