Repository navigation
Description
Summary
launcher.Provision (new in spawn v0.43.0, the pkg/launcher from lagotto#19) sets config.UserData to the raw, unencoded output of BuildLinuxBootstrap, but client.Launch passes UserData straight to EC2 RunInstances, which requires it to be base64-encoded. Every headless launch via Provision therefore fails:
InvalidParameterValue: api error InvalidParameterValue: Invalid BASE64 encoding of user data
This breaks the entire lagotto#19 end-to-end flow on its first real launch — capacity is found, AMI/IAM/bootstrap all succeed, then RunInstances rejects the user-data.
Reproduction
# lagotto v0.39.0 (consumes spawn v0.43.0 launcher.Provision)
lagotto watch g5.12xlarge --action spawn --spawn-config sam.yaml --regions us-west-2 --ttl 7d
lagotto poll --verbose
# → Match found ... → auto-spawn failed: launch: InvalidParameterValue: Invalid BASE64 encoding of user dataRoot cause
pkg/launcher/bootstrap.go—BuildLinuxBootstrapreturns a plain shell script string (correct; it's a builder).pkg/launcher/provision.go:100—config.UserData = bootstrap(assigns the raw script).pkg/aws/client.go:300—UserData: aws.String(launchConfig.UserData)passes it verbatim toRunInstances.
The AWS SDK's RunInstances UserData field must be base64-encoded. The CLI launch path encodes the script before populating LaunchConfig.UserData; launcher.Provision does not, so the library path is missing the encode step.
Fix
In launcher.Provision, base64-encode the bootstrap before assignment:
config.UserData = base64.StdEncoding.EncodeToString([]byte(bootstrap))(Or have client.Launch detect/encode raw user-data — but encoding at the Provision seam matches where the CLI does it and keeps LaunchConfig.UserData's "plain text or base64" contract ambiguous-but-working. Recommend documenting LaunchConfig.UserData as base64-required and encoding in both callers, since the comment at client.go:111 currently says "plain text or base64" which can't both be true for RunInstances.)
Secondary issue: misclassified as terminal
The failure was classified terminal (1 failed, watch stopped) rather than retryable. That's arguably correct for a genuine config error (retrying won't help) — but since this is a spawn-side bug that every Provision call hits, the watch dies on first poll. Once the encoding is fixed this is moot; flagging in case error classification should treat InvalidParameterValue distinctly from capacity errors.
Impact
Blocks lagotto#19's "watch → launch → run → stop" entirely — no headless launch can succeed until this is fixed. Found immediately on first real-world use (BuckAI / fieldwork Tutorial 01, auto-launching SAM inference on g5.12xlarge when capacity appears).
Version
spawn v0.43.0, lagotto v0.39.0
Activity
fix(launcher): base64-encode user-data in Provision (#127) (#128)
docs(changelog): promote Unreleased -> 0.44.1 (#127 fix) (#129)
fix(launch): omit KeyName from RunInstances when unset (#130) (#131)
test(e2e): make the live Provision test a proper Tier 2 test
test(e2e): Tier 2 test for launcher.Provision (catches the #127/#130 …