Repository navigation
SQL: the DDL statements answer HTTP 500 for a caller's mistake: CREATE TYPE ... BUCKET <id> crashes with a NullPointerException, CREATE PROPERTY with a bare-word constraint or over records that do not satisfy it, DROP BUCKET of a bucket that belongs to a type #12436
Description
Summary
Five DDL statements that fail on a caller's mistake answer HTTP 500 Internal error. One of them crashes with a raw java.lang.NullPointerException.
The HTTP API reference lists 400 invalid language, invalid query and 400 invalid command for a statement the server refuses to run, and reserves 500 cannot execute query for a failure of the server itself.
| statement | answer |
|---|---|
CREATE DOCUMENT TYPE WithBuckets BUCKET 1,2,3 |
500 java.lang.NullPointerException: Cannot invoke "com.arcadedb.query.sql.parser.Identifier.getStringValue()" because "b.bucketName" is null |
CREATE PROPERTY T.bad STRING (mandatory maybe) |
500 CommandExecutionException: The value maybe of MANDATORY is a field reference, not a value: there is no record to read it from, so it would be read as null. Quote it as 'maybe' to use it as a text |
CREATE PROPERTY T.bad2 STRING (regexp abc) |
500 CommandExecutionException: The value abc of REGEXP is a field reference, not a value: ... Quote it as 'abc' to use it as a text, or write null to remove the attribute |
CREATE PROPERTY T.m STRING (mandatory true) over records that do not satisfy it |
500 CommandExecutionException: Cannot create property 'T.m': record #1:0 violates it, property 'T.m' is mandatory, but was never set. Fix or delete the non-conforming records first |
DROP BUCKET T_0 (a bucket that belongs to a type) |
500 CommandExecutionException: Cannot drop bucket 'T_0' because used by type 'T' |
The messages of the four CommandExecutionException cases name the problem and say what to do, so only the status is wrong there. The first one is a crash: the statement takes the bucket names the page documents, and a numeric bucket id, which the page also documents, reaches a null name.
Reproduce
Fresh database, T a document type with one record, one HTTP call per statement (POST /api/v1/command/<db>, language sql):
CREATE DOCUMENT TYPE T
CREATE PROPERTY T.x STRING
INSERT INTO T SET x = 'a'
CREATE DOCUMENT TYPE WithBuckets BUCKET 1,2,3
{"error": "Internal error",
"exception": "java.lang.NullPointerException",
"detail": "Cannot invoke \"com.arcadedb.query.sql.parser.Identifier.getStringValue()\" because \"b.bucketName\" is null"}
CREATE PROPERTY T.bad STRING (mandatory maybe)
{"error": "Internal error",
"exception": "com.arcadedb.exception.CommandExecutionException",
"detail": "The value `maybe` of MANDATORY is a field reference, not a value: there is no record to read it from, so it would be read as null. Quote it as 'maybe' to use it as a text"}
CREATE PROPERTY T.m STRING (mandatory true)
{"error": "Internal error",
"exception": "com.arcadedb.exception.CommandExecutionException",
"detail": "Cannot create property 'T.m': record #1:0 violates it, property 'T.m' is mandatory, but was never set. Fix or delete the non-conforming records first"}
DROP BUCKET T_0
{"error": "Internal error",
"exception": "com.arcadedb.exception.CommandExecutionException",
"detail": "Cannot drop bucket 'T_0' because used by type 'T'"}
The refusal of the mandatory property is the one the reference page describes:
When you create a property, ArcadeDB reads the records already stored in the type (including its subtypes) and checks them against the declaration: the declared type ...,
mandatory,notnull,min,maxandregexp. If a record does not satisfy the declaration, the statement fails, names the first offending record, and the property is not created.
and the refusal of a bucket that belongs to a type is the one the buckets page describes:
A bucket belongs to one type only. The statement is refused when a bucket it would attach already belongs to another type ...
Measured on
arcadedata/arcadedb:26.12.1-SNAPSHOTwith the engine, server and network jars of main1541bf7f9f9a3f670a54e42b05c1071cc9c3a514in/home/arcadedb/libarcadedata/arcadedb:26.10.1(the released image), which answers the same for every statement of the table (the message of themandatory maybecase is the older one, and theregexp abccase is accepted there instead of being refused)
Expected
The statements are refused with HTTP 400 and the message that names the problem, as the other DDL statements of the reference do (Bucket 'nosuch' was not found, Type with name 'NoSuchType' was not found, Cannot create the index on type 'T.nosuch' because the property does not exist are all 400).
The numeric bucket id does not crash: either the statement takes the bucket names only and says so, or it takes the ids the page documents and refuses the names it cannot resolve.
Notes
- Related to SQL: statements with user errors answer HTTP 500: SET x = @this overflows the stack, @rid during INSERT throws NullPointerException, null percentile/search_index arguments and bad expand/aggregate nesting are internal errors #11850 and SQL: the graph statements answer HTTP 500 for a caller's mistake: CREATE EDGE with a document as an endpoint (raw ClassCastException), MATCH with a rid that is not a rid, MATCH ... ORDER BY @rid #12425, which list other statements that answer 500 for a caller's mistake. The DDL statements are not in either list.
- [INFERENCE] The
NullPointerExceptioncomes from reading the bucket name of a bucket that was given as a number: the parser keeps the identifier of the bucket, and the code that reads it expects a name.
Activity
shaunpatterson commentedon Nov 17, 2026
One more statement of the same family, found while checking the property pages:
ALTER PROPERTY T.x MIN 'abc'CommandExecutionException: The MIN 'abc' of property 'T.x' cannot be read as a number of charactersThe message names the problem, so only the status is wrong, like the other
CommandExecutionExceptioncases of the issue. Measured on the same build (main1541bf7f9f) and onarcadedata/arcadedb:26.10.1, which answers the same.test(ArcadeData#12436): the no-write assertions count stored records …
fix(ArcadeData#12436): the constraints a ValidationException already …
fix(ArcadeData#12436): a value the stored time-series samples break (…
fix(ArcadeData#12436): the ValidationException cause of a time-series…
test(ArcadeData#12436): list the time-series value refusal in the Val…
fix(ArcadeData#12436): every DDL refusal of the issue answers 400; ex…
fix(ArcadeData#12436): a forwarded DDL refusal keeps its 400 on a fol…
fix(#12425): a non-vertex edge endpoint, a malformed RID and an ORDER…
fix(ArcadeData#12436): DDL refusals of a caller's mistake answer 400 …
lvca commentedon Nov 23, 2026
Fixed by #12451, ships in 26.12.1.
What was wrong: these statements were refused for a mistake in the statement itself, or for the state of the schema, but the refusal was reported as a server failure (HTTP 500). One of them,
CREATE TYPE ... BUCKET <id>, did not even get that far and crashed with aNullPointerException, because only bucket names were handled.What changes for you:
CREATE DOCUMENT TYPE X BUCKET 1,2,3works: a bucket given by its ID is attached to the new type. The bucket must exist already, and an unknown ID is refused with HTTP 400. A bucket given by its name is still created when it does not exist.(mandatory maybe),(regexp abc)) and a MIN or MAX that cannot be read (ALTER PROPERTY T.x MIN 'abc') answer 400 with the same message as before.CREATE PROPERTY ... (mandatory true)orNOTNULL trueover records that already break it answers 400Constraint violated (MANDATORY)/(NOT_NULL), like the MIN, MAX and REGEXP refusals over stored data. The same holds for a TIMESERIES type whose stored samples break the new constraint.DROP BUCKETof a bucket that belongs to a type answers 400, and the bucket keeps its records. Detach it withALTER TYPE ... BUCKET -<bucket>or drop the type to remove it.Over PostgreSQL, Bolt and MongoDB these refusals now come back as client errors too, instead of internal ones. On a cluster, a follower that forwards such a statement to the leader answers its client with the same 400.
❤️ 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.
Merge branch 'main' into fix/12809-ddl-validation-400
fix(ArcadeData#12809): an openCypher type constraint the stored value…