{"record":{"id":"10e8aa3647698eef","repo":"mem0ai/mem0","slug":"bad-request-to-path-detail-10e8aa","errorCode":null,"errorMessage":"Bad request to ${path}: ${detail}","messagePattern":"Bad request to (.+?): (.+?)","errorType":"http","errorClass":"APIError","httpStatus":400,"severity":"error","filePath":"integrations/openclaw/backend/platform.ts","lineNumber":74,"sourceCode":"    const resp = await fetch(url, fetchOpts);\n\n    if (resp.status === 401) {\n      throw new AuthError();\n    }\n    if (resp.status === 404) {\n      throw new NotFoundError(path);\n    }\n    if (resp.status === 400) {\n      let detail: string;\n      try {\n        const body = (await resp.json()) as Record<string, unknown>;\n        detail =\n          ((body.detail ?? body.message ?? JSON.stringify(body)) as string) ??\n          resp.statusText;\n      } catch {\n        detail = resp.statusText;\n      }\n      throw new APIError(path, detail);\n    }\n    if (!resp.ok) {\n      let detail: string = resp.statusText;\n      try {\n        const body = (await resp.json()) as Record<string, unknown>;\n        detail = (body.detail ?? body.message ?? resp.statusText) as string;\n      } catch {\n        /* ignore */\n      }\n      throw new Error(`HTTP ${resp.status}: ${detail}`);\n    }\n    if (resp.status === 204) {\n      return {};\n    }\n    return resp.json();\n  }\n\n  async add(","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/integrations/openclaw/backend/platform.ts#L56-L92","documentation":"POST /auth/login found the user by email but bcrypt verification of the submitted password against the stored hash failed, yielding the same generic 401 as a missing account. Only the exact original password verifies; there is no recovery from the API itself beyond admin-driven reset.","triggerScenarios":"Wrong password (typo, stale credential, changed password); password from a different environment's account; trailing whitespace introduced when pasting the password; credentials rotated by an admin after they were stored in the client.","commonSituations":"CI secrets holding an old password after an admin reset; password managers auto-filling outdated entries; local dev password differing from the seeded one; copy/paste adding a trailing newline in shell scripts.","solutions":["Re-enter the correct password carefully (watch for caps-lock/whitespace); .strip() shell-provided values.","If forgotten and another admin exists, have the admin reset it via user management; if it is the only admin, an operator with DB access can set a new hash via the server's hash_password utility.","Update stored secrets/CI variables after any credential rotation and test with a manual login before retrying the pipeline."],"exampleFix":"# before\npassword=$(cat pw.txt)   # may include trailing newline -> 401\nlogin(email, password)\n\n# after\npassword=$(cat pw.txt | tr -d '\\n')\nlogin(email, password)","handlingStrategy":"validation","validationCode":"def validate_login_input(password: str) -> str:\n    pw = password.strip()\n    if len(pw) < 8:\n        raise ValueError(\"Password shorter than the server minimum of 8; likely truncated or wrong field\")\n    return pw","typeGuard":"def is_credential_candidate(password: str | None) -> bool:\n    return isinstance(password, str) and len(password.strip()) >= 8","tryCatchPattern":"if resp.status_code == 401 and \"Invalid email or password\" in resp.text:\n    if attempt < MAX_ATTEMPTS:\n        password = prompt_fresh_password()  # re-collect; never retry the same value blindly\n    else:\n        raise CredentialsError(\"Password rejected; rotate via admin reset\")","preventionTips":["Strip whitespace/newlines from secret values read from files or env.","Update CI/secret-manager entries immediately after password rotations.","Prefer API keys over shared passwords for automation."],"tags":["auth","login","http-401","rest-server"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}