Repository navigation
Description
Summary
The server answers POST /api/v1/server/users with 403 Security error when the user name already exists. The OpenAPI contract for createUser declares 409 for that case. Because 403 is also what a non-root caller gets, a client cannot tell "this user already exists" apart from "you may not do this" without matching on the detail text.
Reproduce (26.11.1-SNAPSHOT image, pulled 2026-10-15)
curl -s -u root:playwithdata -H 'Content-Type: application/json' \
-d '{"name":"alice","password":"a-long-password"}' http://localhost:2480/api/v1/server/users # 201
curl -s -u root:playwithdata -H 'Content-Type: application/json' \
-d '{"name":"alice","password":"a-long-password"}' http://localhost:2480/api/v1/server/users # 403The second call answers:
403 {"error":"Security error","detail":"User 'alice' already exists", ...}
The contract, paths["/api/v1/server/users"].post.responses, lists 201, 400, 401, 403, 409, 500, 504.
Cause
PostUserHandler → ServerSecurity.createUserClusterWide (and createUser on the non-HA path) throws ServerSecurityException("User '<name>' already exists"). AbstractServerHttpHandler.isSecurityFailure treats every ServerSecurityException as a security failure and maps it to 403 "Security error".
Why it matters
A multi-tenant application that provisions a user per tenant wants create-if-absent. With 409 it can treat the conflict as success. With 403 it has to either string-match detail or list users first, which is racy. The Go client in arcadedb-drivers (ArcadeData/arcadedb-drivers#126) documents the 403 and pins it in its e2e suite rather than classifying it. The Python and TypeScript clients will do the same until this is resolved.
Suggested fix
Either:
- Throw a non-security exception for the duplicate, for example a dedicated
UserAlreadyExistsException, mapped to 409. This matches the contract and HTTP semantics, and keeps 403 meaning "not authorized". Or - If 403 is intended, change the contract to drop 409 and describe the 403.
Option 1 seems right. The same check may be worth doing for createOrUpdateGroup and createApiToken, whose contracts also declare 409.
Related observation (not necessarily a bug)
create database <name> through POST /api/v1/server on an existing name answers 400 Cannot execute command, with detail: "Database '<name>' already exists" (an IllegalArgumentException). A 409 there would give clients the same create-if-absent signal.
Activity
fix(#10073): creating a user under a taken name answers 409, not 403 …
robfrank commentedon Oct 15, 2026
Fixed in #10076. Creating a user under a name that already exists was reported as a security refusal, so it answered 403, the same status a caller who is not root gets. It is now reported as a conflict: 409 on
POST /api/v1/server/usersand on thecreate userserver command, andALREADY_EXISTSover gRPC. ThecreateUsercontract documents the 409. A caller who is not root still gets 403, so a client can now treat 409 as "already there" for create-if-absent. Suggested sibling checks:createApiTokenalready answered 409 for a taken name, andcreateOrUpdateGroupis an upsert, so it cannot conflict.Note for Java users:
RemoteServer.createUseron a taken name now throws aRemoteExceptionwhose message names the conflict, instead of aSecurityException.Still open:
create databaseon an existing name (your related observation) still answers 400 over HTTP; gRPC already answersALREADY_EXISTS.❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
feat(#122): server administration and sqlscript in the Python HTTP cl…
fix(#10073): creating a user under a taken name answers 409, not 403 …