{"record":{"id":"759be2f85908b01e","repo":"Significant-Gravitas/AutoGPT","slug":"oauth-app-not-found","errorCode":null,"errorMessage":"OAuth App not found","messagePattern":"OAuth App not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/oauth.py","lineNumber":635,"sourceCode":"    \"\"\"\n    Update the logo URL for an OAuth application.\n\n    Only the application owner can update the logo.\n    The logo should be uploaded first using the media upload endpoint,\n    then this endpoint is called with the resulting URL.\n\n    Logo requirements:\n    - Must be square (1:1 aspect ratio)\n    - Minimum 512x512 pixels\n    - Maximum 2048x2048 pixels\n\n    Returns the updated application info.\n    \"\"\"\n    if (\n        not (app := await get_oauth_application_by_id(app_id))\n        or app.owner_id != user_id\n    ):\n        raise HTTPException(\n            status_code=status.HTTP_404_NOT_FOUND,\n            detail=\"OAuth App not found\",\n        )\n\n    # Delete the current app logo file (if any and it's in our cloud storage)\n    await _delete_app_current_logo_file(app)\n\n    updated_app = await update_oauth_application(\n        app_id=app_id,\n        owner_id=user_id,\n        logo_url=request.logo_url,\n    )\n\n    if not updated_app:\n        raise HTTPException(\n            status_code=status.HTTP_404_NOT_FOUND,\n            detail=\"Application not found or you don't have permission to update it\",\n        )","sourceCodeStart":617,"sourceCodeEnd":653,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/oauth.py#L617-L653","documentation":"Returned (404) by the set-logo-URL endpoint when get_oauth_application_by_id(app_id) finds nothing or the found app's owner_id does not match the calling user. This is a pre-flight ownership check done before any storage or update work.","triggerScenarios":"POST logo-url with a non-existent app_id, an app owned by someone else, or a user_id derived from an expired/mismatched auth session.","commonSituations":"Hard-coded app_id from another environment; app deleted between page load and submit; multiple accounts logged in in the same browser causing user id confusion.","solutions":["Verify the app exists and the current user owns it (re-fetch the app list) before submitting the logo URL","Use the app id returned by the create/list API rather than a manually typed one","Re-authenticate if the session user changed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"app = await get_oauth_application_by_id(app_id)\nif app is None or app.owner_id != user_id:\n    raise PermissionError(\"not the app owner — abort before POST\")","typeGuard":"def is_app_owner(app: OAuthAppInfo | None, user_id: str) -> bool:\n    return app is not None and app.owner_id == user_id","tryCatchPattern":"if resp.status_code == 404:\n    # either bad app_id or wrong user session — verify both before retry\n    pass","preventionTips":["Validate ownership client-side before any logo mutation","Re-fetch the app right before the mutation to catch deletions","Keep one authenticated session per browser profile"],"tags":["oauth","http-404","authorization","api"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}