Skip to content

GET /api/v1/settings/sources/{id} – Internal Server Error when accessing non-existing ID #113

Open
@sagarkumar-webkul

Description

@sagarkumar-webkul

API Issue Report


Title

GET /api/v1/settings/sources/{id} – Internal Server Error when accessing non-existing ID


Description

When performing a GET request to /api/v1/settings/sources/{id} using a non-existing or invalid ID, the API returns a 500 Internal Server Error.

Instead, the server should handle the request gracefully and respond with a proper status code like 404 Not Found along with a meaningful error message, indicating that the record does not exist.


Preconditions

  1. Framework: Laravel (Krayin-based)
  2. Endpoint: GET /api/v1/settings/sources/{id}
  3. Invalid/non-existing ID is used (e.g., /sources/53 in this case)

Steps to Reproduce

  1. Make a GET request to /api/v1/settings/sources/{invalid-id}.
  2. Observe the response:
    {
      "message": "Attempt to read property \"id\" on null",
      "exception": "ErrorException",
      "file": ".../DelegatesToResource.php",
      "line": 139,
      ...
    }

Expected Result

  • API should return:
    {
      "message": "Source not found"
    }
    with HTTP status code 404 Not Found.

Actual Result

  • API returns:
    • HTTP status: 500 Internal Server Error
    • Message: "Attempt to read property \"id\" on null"

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions