Skip to content

bug: 500 Internal Server Error when querying non-existent plugin metadata via Admin API #12618

@TaeyeongKwak

Description

@TaeyeongKwak

Current Behavior

When attempting to retrieve plugin metadata for a non-existent plugin using the Admin API, the server returns a 500 Internal Server Error instead of properly handling the request.

$ curl --location "http://localhost:9180/apisix/admin/plugin_metadata/file-logger" --header "x-api-key: $APISIX_API_KEY"
<html>
<head><title>500 Internal Server Error</title></head>
<body>
<center><h1>500 Internal Server Error</h1></center>
<hr><center>openresty</center>
<p><em>Powered by <a href="https://apisix.apache.org/">APISIX</a>.</em></p></body>
</html>

Expected Behavior

The API should return a 404 Not Found status with an appropriate JSON error message when querying metadata for a non-existent plugin, similar to other Admin API endpoints when resources are not found.

Example expected response:

{
    "message": "Key not found"
}

Error Logs

2025/09/17 10:17:52 [error] 320064#320064: *3867478 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/admin/utils.lua:109: attempt to index local 'conf' (a nil value)
stack traceback:
coroutine 0:
        /usr/local/apisix/apisix/admin/utils.lua: in function 'decrypt_params'
        /usr/local/apisix/apisix/admin/init.lua:242: in function 'handler'
        /usr/local/apisix//deps/share/lua/5.1/resty/radixtree.lua:1013: in function 'dispatch'
        /usr/local/apisix/apisix/init.lua:1032: in function 'http_admin'
        content_by_lua(nginx.conf:212):2: in main chunk, client: 127.0.0.1, server: , request: "GET /apisix/admin/plugin_metadata/file-logger HTTP/1.1", host: "localhost:9180"

Steps to Reproduce

  1. Start APISIX 3.13 with default configuration
  2. Send a GET request to retrieve metadata for a non-existent plugin:
curl --location "http://localhost:9180/apisix/admin/plugin_metadata/file-logger" \
  --header "x-api-key: $APISIX_API_KEY"
  1. Observe the 500 error response instead of 404:
<html>
<head><title>500 Internal Server Error</title></head>
<body>
<center><h1>500 Internal Server Error</h1></center>
<hr><center>openresty</center>
<p><em>Powered by <a href="https://apisix.apache.org/">APISIX</a>.</em></p></body>
</html>

Environment

  • APISIX version (run apisix version): 3.13.0
  • Operating system (run uname -a): Rocky Linux 8.10
  • OpenResty / Nginx version (run openresty -V or nginx -V): openresty/1.27.1.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    🏗 In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions