SWM write via node-level API token crashes with TypeError (toLowerCase on undefined)
Description/Context
Any /api/shared-memory/write call using a node-level auth token returns HTTP 500 with Cannot read properties of undefined (reading 'toLowerCase'). This blocks the write-to-publish-to-on-chain flow via the API.
Steps to reproduce
-
Deploy any rc.12 node (Oxigraph or Blazegraph, any network).
-
Grab the node-level auth token:
TOKEN=$(cat /root/dkg-data/auth.token)
- Create a context graph:
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"id": "test-cg", "name": "Test CG"}' \
http://127.0.0.1:9200/api/context-graph/create | python3 -m json.tool
This succeeds — returns did:dkg:context-graph:test-cg.
- Write triples to shared memory:
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"contextGraphId": "test-cg", "quads": ["<http://example.org/s> <http://example.org/p> \"test\" ."]}' \
http://127.0.0.1:9200/api/shared-memory/write | python3 -m json.tool
Returns {"error":"Cannot read properties of undefined (reading 'toLowerCase')"}.
- Passing an explicit
agentAddress in the body does not help — same error:
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"contextGraphId": "test-cg", "agentAddress": "0x<your-agent-address>", "quads": ["<http://example.org/s> <http://example.org/p> \"test\" ."]}' \
http://127.0.0.1:9200/api/shared-memory/write | python3 -m json.tool
Same {"error":"Cannot read properties of undefined (reading 'toLowerCase')"}.
- Check the daemon log:
tail -20 /root/dkg-data/daemon.log
Shows Sharing 1 quads to SWM for context graph test-cg but not Writing N quads to shared memory ..., confirming the crash happens in the agent layer before the publisher or store is reached.
Root cause
dkg-agent.ts line 5559, inside getWorkspaceGossipSigningAgent():
if (defaultAddress && record.agentAddress.toLowerCase() === defaultAddress) {
When iterating localAgents, a record with a missing/undefined agentAddress causes the crash. This function is called from resolveWorkspaceGossipSigningAgent() (line 7551) during every share() call, including localOnly: true.
Scope
All rc.12 nodes, Oxigraph and Blazegraph alike. Not store-specific. Confirmed by exhaustive .toLowerCase() audit across packages/agent, packages/publisher, packages/storage, and packages/cli.
Found during
RC.12 Blazegraph testnet validation on Ubuntu 24.04 with release/rc.12 branch.
Severity
High — completely blocks the SWM write path for any node-level API consumer.
SWM write via node-level API token crashes with TypeError (toLowerCase on undefined)
Description/Context
Any
/api/shared-memory/writecall using a node-level auth token returns HTTP 500 withCannot read properties of undefined (reading 'toLowerCase'). This blocks the write-to-publish-to-on-chain flow via the API.Steps to reproduce
Deploy any rc.12 node (Oxigraph or Blazegraph, any network).
Grab the node-level auth token:
TOKEN=$(cat /root/dkg-data/auth.token)This succeeds — returns
did:dkg:context-graph:test-cg.Returns
{"error":"Cannot read properties of undefined (reading 'toLowerCase')"}.agentAddressin the body does not help — same error:Same
{"error":"Cannot read properties of undefined (reading 'toLowerCase')"}.Shows
Sharing 1 quads to SWM for context graph test-cgbut notWriting N quads to shared memory ..., confirming the crash happens in the agent layer before the publisher or store is reached.Root cause
dkg-agent.tsline 5559, insidegetWorkspaceGossipSigningAgent():When iterating
localAgents, a record with a missing/undefinedagentAddresscauses the crash. This function is called fromresolveWorkspaceGossipSigningAgent()(line 7551) during everyshare()call, includinglocalOnly: true.Scope
All rc.12 nodes, Oxigraph and Blazegraph alike. Not store-specific. Confirmed by exhaustive
.toLowerCase()audit acrosspackages/agent,packages/publisher,packages/storage, andpackages/cli.Found during
RC.12 Blazegraph testnet validation on Ubuntu 24.04 with
release/rc.12branch.Severity
High — completely blocks the SWM write path for any node-level API consumer.