Service method errors incorrectly reported as -32601 Method not found #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When a service method (e.g.
authservice.login) returns an application error (wrong password, expired challenge, etc.), the dispatch layer wraps it as JSON-RPC-32601 Method not foundinstead of a proper application error.This affects ALL service methods across ALL domains — any
handle_service_callerror becomes "Method not found".Root Cause
packages/osis/src/rpc/dispatch.rsline 143-145:Service methods go through
handle_service_callbecause their type name (e.g.authservice) is not a CRUD type. Whenhandle_service_callreturnsErr, the dispatch wraps it withmethod_not_foundinstead of a proper error code.Example
RPC error [-32601]: Method not foundRPC error [-32000]: Authentication failedThe actual error message ("Authentication failed") is lost because the SDK client reads the
messagefield which is hardcoded to "Method not found".Fix
application_error()constructor toJsonRpcErrorusing code-32000(JSON-RPC server error range)dispatch.rsinstead ofmethod_not_foundfor service call errors