Skip to content

BUG: API routes return malformed JSON — jsonify(data, status_code) should be jsonify(data), status_code #134

Description

@Xarlos89

Description

Several API route files pass the HTTP status code as a second positional argument to jsonify() instead of returning it as a separate tuple element. Flask serializes both arguments as a JSON array, so the response body is wrong and the HTTP status code is always 200.

Affected files

File Lines
src/api/routes/roles.py 28, 39, 41, 52, 54, 64, 66
src/api/routes/logging.py 28, 51, 53, 64, 66, 76, 78
src/api/routes/settings.py 28, 39, 41, 52, 54, 64, 66
src/api/routes/healthchecks.py 19, 21, 32, 35, 37

Example

# Wrong — Flask serializes this as JSON array: [{...}, 200]
return jsonify(result, 200)

# Correct — status code is returned as HTTP response code
return jsonify(result), 200

Impact

  • All responses from these routes return HTTP 200 regardless of the actual status (errors are swallowed)
  • The response body is a JSON array [{...}, 200] instead of a plain object {...}
  • Bot-side api_helper.py receives malformed responses, causing silent data parsing failures

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions