Skip to content

Cypher dynamic labels: SET n:$(expr) creates a literal vertex type named '$(expr)' #7059

Closed

Description

@g33kroid

Version

26.9.1-SNAPSHOT (build a7d0e4685d79afdb10061f868b29f34a3fe27482, main), BoltProtocolPlugin enabled.

Summary

Neo4j 5 dynamic label syntax — SET n:$(expression) — is not interpolated. ArcadeDB instead creates a vertex type whose name is the literal text $(node.labels), and attaches it to the affected nodes.

No error is raised at write time. It surfaces later, when a client reads those nodes back and finds an invalid label.

Reproduction

UNWIND $nodes AS node
MERGE (n:Entity {uuid: node.uuid})
SET n:$(node.labels)
SET n = node
RETURN n.uuid

with $nodes = [{uuid: 'a', labels: 'Finding', name: 'x'}, ...]

Result

SELECT name FROM schema:types
-- '$(node.labels)', '$(node.labels)~Entity', 'Entity', 'Entity~Finding', ...
MATCH (n:Entity) RETURN DISTINCT labels(n) AS l, count(*) AS c
-- {'l': ['$(node.labels)', 'Entity'], 'c': 4}

Four nodes carry $(node.labels) as an actual label, and two junk types are now in the schema.

Expected

Either the expression is evaluated and the intended label applied, or the statement is rejected as unsupported syntax. Silently creating a type named after the uninterpolated expression is the worst of the three outcomes — it corrupts the schema and the data without surfacing anything.

Impact

This is the query graphiti emits for bulk node saves (node_db_queries.py:263). Ingesting one episode appears to succeed; the next episode's deduplication reads those nodes back, rejects the label, and the pipeline stops. Any Neo4j-compatible client using dynamic labels will hit the same thing.

Activity

  1. added this to the 26.9.1 milestone on Sep 2, 2026
  2. self-assigned this
    on Sep 2, 2026
  3. added
    in progress
    on Sep 2, 2026
  4. added 2 commits that reference this issue on Sep 3, 2026
  5. robfrank commented on Sep 3, 2026

    @robfrank
    Collaborator

    Fixed in #7081, merged to main.

    The Neo4j 5 dynamic-label syntax SET n:$(expression) parsed, but the expression was never interpolated: the clause flattened the whole label subtree to its source text, so a vertex type literally named $(node.labels) was created and attached to your nodes, with no error at write time. REMOVE n:$(expression) had the mirror-image defect and silently did nothing. Both clauses now evaluate the expression per row and use the value it yields, accepting a string or a list of strings and rejecting anything that cannot be a type name instead of converting it into one. Two long-standing gaps in the same code went with it: REMOVE n IS Label was unimplemented, and a variable read only through a label expression could be dropped from the query plan.


    ❤️ 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.

  6. removed
    in progress
    on Sep 3, 2026
  7. added a commit that references this issue on Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions