Skip to main content
← Back to list
01Issue
BugShippedSwamp CLI
Assigneesstack72

Relationships

#1266 method_execution_service.ts:852 crashes on undefined.trim() when writeResource receives undefined instance name

Opened by stack72 · 7/18/2026· Shipped 7/18/2026

Summary

method_execution_service.ts:852 calls .trim() on the resource instance name passed to writeResource() without guarding against undefined. If an extension's method calls context.writeResource(specName, undefined, data), core crashes with:

Cannot read properties of undefined (reading 'trim')
    at file:///tmp/deno-compile-swamp/src/domain/models/method_execution_service.ts:852:25

Reproduction

Triggered by @swamp/s3-datastore-bootstrap/provisioner (issue #1237) when its GlobalArgsSchema declared a name field that wasn't wired as a workflow input. The resolved globalArgs.name was undefined, passed through to writeResource("state", undefined, state).

The extension-side fix (PR swamp-extensions#117) removes the name field, but core should defensively validate the instance name before calling .trim() — either throw a descriptive error ("writeResource instance name must be a string") or skip the .trim() if the value is already a string.

Expected behavior

Core should throw a clear validation error like "writeResource: instance name must be a non-empty string, got undefined" rather than crashing on an unguarded property access.

Environment

  • swamp: 20260718.014016.0-sha.93325715
  • Triggered via workflow execution path (DefaultStepExecutor.invokeMethod)
02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 2 MOREREVIEW+ 4 MOREPR_MERGED+ 1 MORENOTIFICATION_SKIPPED

Shipped

7/18/2026, 11:39:34 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack727/18/2026, 11:11:11 PM

Sign in to post a ripple.