Skip to content

Step Functions: StartSyncExecution answers InvalidDefinition where AWS names StateMachineTypeNotSupported #996

Closed

Description

@scttfrdmn

StartSyncExecution refuses a STANDARD state machine with InvalidDefinition, a code its page does not publish, where AWS names StateMachineTypeNotSupported.

Surfaced while implementing #912. The ARN resolution in startSyncExecution is fixed there; the two InvalidDefinition answers are not, because the code is wrong for a different reason and the fix has its own acceptance criteria.

What AWS publishes

API_StartSyncExecution lists nine errors, in full:

Code Status
InvalidArn 400
InvalidExecutionInput 400
InvalidName 400
KmsAccessDeniedException 400
KmsInvalidStateException 400
KmsThrottlingException 400
StateMachineDeleting 400
StateMachineDoesNotExist 400
StateMachineTypeNotSupported 400

InvalidDefinition is not among them, and neither is ValidationException. StateMachineTypeNotSupported — "State machine type is not supported." — is the code for the case substrate is answering, and the page states the restriction outright:

StartSyncExecution is not available for STANDARD workflows.

What substrate answers today

startSyncExecution (emulator/stepfunctions_plugin.go) answers InvalidDefinition/400 twice:

  1. When sm.Type != "EXPRESS", with the message "StartSyncExecution is only supported for EXPRESS workflows" — the right refusal under the wrong code. A consumer branching on the code sees a claim about the ASL document, which is not what is wrong.
  2. When the stored ASL fails to parse. InvalidDefinition is a real Step Functions code — it is published at API_CreateStateMachine and API_UpdateStateMachine, where a definition arrives in the request — but not here, where the definition is substrate's own stored copy and the caller supplied nothing to be wrong about. CreateStateMachine accepted that definition, so this path is reachable only for a definition substrate itself stored and cannot read back.

The second is the more interesting half: it is an internal inconsistency being reported as a caller error.

Acceptance criteria

  • StartSyncExecution against a STANDARD state machine answers StateMachineTypeNotSupported/400 with AWS's message, "State machine type is not supported."
  • Decide what the unparseable-stored-definition path answers, and record it in docs/services.md as substrate's reading. InvalidDefinition is not published here; the candidates are AWS's ValidationException (also not published on this page), a 500 (CommonErrors publishes none for Step Functions beyond ServiceQuotaExceededException/402 and the throttling codes), or demonstrating the path is unreachable because CreateStateMachine and UpdateStateMachine both validate on the way in — in which case it is a fmt.Errorf, not an AWSError.
  • Check whether CreateStateMachine and UpdateStateMachine do in fact refuse an unparseable definition today. If either accepts one, that is the defect to fix and this path becomes unreachable.
  • Audit the other three startExecution-family paths for the same substitution: startExecution sets exec.ErrorDetails = "InvalidDefinition: " + err on a parse failure and reports the execution FAILED, which is a different shape — an execution-level failure rather than a request-level refusal — and may well be right. Record which it is.
  • API_StartSyncExecution is Express-only and served on a sync- prefixed endpoint host at AWS. Whether substrate models that host is out of scope here, but note in docs/services.md whether it does; the host was not obtained while researching Eleven Step Functions operations resolve a resource by the ARN's last segment plus the caller's own account and Region #912.
  • Behavioural tests over the wire through emulator.StartTestServer, every ARN taken from a CreateStateMachine response per cfn: the aws:cloudformation:* stamp covers EC2 only, so the rest of a stack is unstamped #765: a STANDARD state machine answers StateMachineTypeNotSupported, an EXPRESS one succeeds, and the code is asserted on the raw response body rather than through a decoded struct.
  • CHANGELOG.md under ## [Unreleased].

Provenance

API_StartSyncExecution's error list and its "not available for STANDARD workflows" sentence, read in full while researching #912. Every Step Functions error on all eleven pages fetched is HTTP 400.

Activity

  1. added this to the v0.119.0 milestone on Sep 17, 2026
  2. added
    type: bug
    on Sep 17, 2026
  3. scttfrdmn commented on Sep 18, 2026

    @scttfrdmn
    OwnerAuthor

    Premise corrections before the PR opens

    The error list, the status codes and the "not available for STANDARD workflows" sentence all verify exactly as the body states, and StateMachineTypeNotSupported's message is verbatim "State machine type is not supported." Four things need correcting or settling first.

    1. The "demonstrate it is unreachable" option is not available. Acceptance criterion 3 asks whether CreateStateMachine and UpdateStateMachine refuse an unparseable definition today. Neither parses definition at all. createStateMachine decodes five members and checks only that name is non-empty; updateStateMachine assigns sm.Definition = input.Definition whenever the member is non-empty. So the unparseable-stored-ASL path in startSyncExecution is live, not hypothetical, and that is the underlying defect the issue predicted.

    2. There is a second, concrete producer of an unreadable stored definition, reached through CloudFormation. deployStepFunctionsStateMachine (cfn_resources_v20.go:25) does:

    def := marshalToJSON(props["DefinitionString"])

    DefinitionString is a CloudFormation string property. Marshalling a Go string to JSON quotes and escapes it, so a template carrying "DefinitionString": "{}" stores the definition "\"{}\"" — a JSON string literal, which json.Unmarshal into StateMachineDefinition rejects with "cannot unmarshal string into Go value of type". cfn_intrinsics_test.go:628 is exactly that template, so every deploy of a AWS::StepFunctions::StateMachine with a DefinitionString in the repo today stores a definition substrate cannot read back. This is fixed in the same PR, because it is the live route to the path the issue is about.

    3. AWS publishes nothing about the sync- endpoint host on this page. Acceptance criterion 5 asks docs/services.md to note whether substrate models it. The page's Request Syntax, Request Parameters, Response Syntax, Errors and both Notes say nothing about an endpoint host at all — the sync- prefix comes from the endpoints reference, not from here. So docs/services.md will record that substrate does not model it and that this page is not a source for it, rather than asserting a host shape.

    4. The page's own Note decides criterion 4, and it cuts against the current startExecution shape. API_StartSyncExecution says:

    StartSyncExecution will return a 200 OK response, even if your execution fails, because the status code in the API response doesn't reflect function errors. Error codes are reserved for errors that prevent your execution from running, such as permissions errors, limit errors, or issues with your state machine code and configuration.

    An unreadable definition is an issue with the state machine's code, which AWS puts on the error-code side of that line rather than the 200-with-error side. But none of the nine published codes fits it, and that is the point: AWS has no code for it because AWS would never have accepted the definition. So the resolution is the one criterion 3 names — validate on the way in, which makes both parse paths unreachable — and the residual becomes an internal inconsistency rather than a caller error.

    Consequently startExecution's exec.ErrorDetails = "InvalidDefinition: " + err also stops being reachable. It is left as an execution-level failure rather than promoted to a request refusal, since that is the shape AWS's Note describes for a running execution, but the name changes: InvalidDefinition is an API error code and has no business appearing as an ASL execution error name. States.Runtime is the published ASL name for a failure that cannot be processed.

    Scope, and what is filed separately

    This PR validates that a stored definition is parseable JSON describing an object — precisely the property whose absence produces the defect. It does not validate ASL structure. {} remains acceptable here although AWS would refuse it, because "a state machine MUST have a string field named StartAt" and "…an object field named States" is Amazon States Language conformance, which is a larger job with its own citation trail. docs/services.md states that boundary rather than implying full validation.

    Filed separately, all found in the handlers this PR touches:

    • StartSyncExecution's success body omits nine published members, including the error/cause pair — which is where ExecutionState.ErrorDetails belongs, and the reason it currently has nowhere to go.
    • createStateMachine answers StateMachineAlreadyExists at 409 where the page publishes 400, and answers InvalidParameterException for a missing name — a code API_CreateStateMachine does not publish. It also never checks roleArn, which is Required: Yes.
    • ASL structural validation (StartAt, States, and StartAt naming a member of States).
    • DefinitionString is not resolved through the intrinsic context, unlike every sibling property in the same function, so an Fn::Sub in a definition reaches the stored record unresolved.
  4. added 3 commits that reference this issue on Sep 18, 2026
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: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions