Skip to content

--command > 256 chars fails RunInstances (command delivered via spawn:command EC2 tag) #214

Closed

Description

@scttfrdmn

Summary

--command (and the command: field in a launch/spawn config) longer than 256 characters causes RunInstances to fail with:

InvalidParameterValue: Tag value exceeds the maximum length of 256 characters

The instance never launches. This is a hard ceiling on a documented feature (run-a-workload-on-boot), and it's easy to exceed with any non-trivial inline script.

Root cause

spawn delivers the workload by writing it to the spawn:command EC2 tag, which the Linux bootstrap reads at boot:

  • pkg/launcher/bootstrap.go:426 — bootstrap reads the workload from the spawn:command tag (aws ec2 describe-tags ... Name=key,Values=spawn:command).
  • The command value is therefore tagged at launch time, and AWS caps tag values at 256 characters, so any longer command is rejected by RunInstances.

Reproduction (hit live, 2026-06-17)

Via lagotto --action spawn (which maps command → JobArrayCommand → spawn:command tag), a ~1.4 KB inline probe script produced:

auto-spawn failed: ... api error InvalidParameterValue: RunInstances ...
Tag value exceeds the maximum length of 256 characters

Shortening the command to a <256-char one-liner that fetches the real script from S3 worked. So the workload mechanism is fine; only the transport (EC2 tag) is length-limited.

Impact

  • Any spawn launch --command '<longer than 256 chars>' fails to launch.
  • lagotto --action spawn with a realistic command: silently fails the same way (lagotto correctly forwards it; the limit is here).
  • The failure mode is opaque — the error mentions "Tag value", not "--command too long".

Proposed fixes (in order of preference)

  1. Don't put the command in a tag. Pass it via EC2 user-data (16 KB limit) — write it to a file in the bootstrap, or base64 it into a spawn:command-ref. user-data is the natural place for boot workloads.
  2. For long commands, stage to S3 automatically: if len(command) > N, upload it to the spawn-binaries/scratch bucket and tag spawn:command-s3 with the URI; bootstrap fetches+executes. (This is the workaround users currently do by hand.)
  3. At minimum, fail fast with a clear error: if len(command) > 256 and the tag transport is used, error before RunInstances with "command exceeds 256-char tag limit; use a script URL or user-data", instead of surfacing the raw AWS tag error.

Environment

  • spawn (current local build), lagotto --action spawn, region sa-east-1, AMI on Ubuntu 24.04.

Activity

  1. added
    bug
    area:launch
    on Jun 17, 2026
  2. added a commit that references this issue on Jun 25, 2026
  3. scttfrdmn commented on Jun 25, 2026

    @scttfrdmn
    ContributorAuthor

    Fixed in #250 (v0.68.0): --command is now embedded in user-data instead of the 256-char spawn:command tag.

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

    area:launchbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions