Skip to content

Agent: create_relationship fails when linking nodes to newly-created schema instances #1077

Closed

Description

@malibio

Problem

When the agent creates a node of a user-defined schema type and then tries to link other nodes to it via create_relationship, the operation fails with a "target node ID not found" error.

Observed in the following sequence:

  1. Agent creates a project schema (via create_schema)
  2. Agent creates a project node (via create_node)
  3. Agent creates several task nodes
  4. Agent calls create_relationship to link each task to the project — fails: target node ID not found

The project node was just created successfully (agent references its nodespace:// URI in the response), so the issue is likely in how create_relationship resolves node IDs for schema-typed nodes, or the node is not yet visible to the relationship handler (possible eventual consistency / indexing lag).

Steps to Reproduce

  1. Ask the agent: "Create a 'Project' node type with a has_task relationship"
  2. Ask: "Create a sample project entry"
  3. Ask: "Create a few tasks and assign them to the project"
  4. Agent reports relationship creation failed: target node ID not found

Expected Behavior

create_relationship should successfully link nodes regardless of whether the source/target is a core type (task) or a user-defined schema type (project).

Investigation Areas

  • Does create_relationship MCP handler look up nodes differently for schema-typed nodes vs core types?
  • Is there a timing/indexing issue — node is written but not yet readable by ID when relationship creation runs?
  • Does the relationship handler validate that both node IDs exist before creating the edge, and if so, is that query path correct for all node types?
  • Verify end-to-end: create_node with a schema type → immediately query by returned ID → create_relationship using that ID

Context

  • Agent successfully creates the schema and instance nodes
  • Relationship name (has_task) matches the schema definition
  • Error occurs on the create_relationship tool call, not on node creation
  • May be related to how schema-typed node IDs are stored/indexed vs queried
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions