Repository navigation
fix(ssm): detect ParameterNotFound when the SDK error name is generic - #5563
Draft
oxatruchdev wants to merge 1 commit into
Draft
oxatruchdev wants to merge 1 commit into
oxatruchdev wants to merge 1 commit into
Conversation
The runner group cache store and the runner config consumer only treated an SSM error as "parameter not found" when its `name` was `ParameterNotFound`. When the AWS SDK cannot resolve the modeled exception class it throws a plain `Error` whose name is `Error` and whose message is the error code, decorated with `$fault`, `$metadata` and the parsed error body (`__type`). The cache miss was then rethrown instead of returning `undefined`, so every ephemeral JIT launch failed until the cache parameter was created by hand. Add a shared `isParameterNotFoundError` helper that walks the cause chain and matches the modeled name, the SDK error code fields (`__type`, `Code`, `code`) or the `ParameterNotFound` message on a generically named error, and use it in both stores. Other errors (access denied, throttling, ...) are still rethrown.
oxatruchdev
marked this pull request as draft
October 30, 2026 00:58
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
What fails
On a multi-runner deployment of v8.0.0 with ephemeral runners using JIT config, every launch fails on a runner group cache miss. The scale-up Lambda logs
Runner group cache lookup failedfollowed byUnexpected error while registering GitHub runners. The instances are terminated and the SQS message is retried indefinitely.The error that reaches
AwsSsmRunnerGroupCacheStore.get()is:Root cause
isParameterNotFoundErrorinrunner-group-cache-store.tsonly matched errors in the cause chain whosenameisParameterNotFound. In the error above, neither error in the chain has that name.In the
@aws-sdk/coreversion locked at v8.0.0 (3.973.23),ProtocolLib.getErrorSchemaOrThrowBaseExceptionhas a fallback for when the modeled exception schema cannot be resolved from the type registry and no synthetic base exception is registered:So the thrown error has:
name: 'Error'(plainError)message: 'ParameterNotFound'(the error code)$fault: 'client'and$metadata(HTTP status, request id, ...)decorateServiceException. For awsJson1_1 this includes__type(ParameterNotFound, possibly namespaced...#ParameterNotFound). The body'smessageis not copied because the error already has one.The current
@aws-sdk/core(3.978.x) builds this fallback asnew Error(message)withname: errorName, so the name survives there. The store should still not depend on which path the SDK takes.runner-config-consumer.tshad the same name-only check (isSsmNotFound) on its rawGetParameterCommandpath. With the fallback error it would stop polling withFailed to read runner configurationinstead of waiting for the parameter.Fix
This adds a shared helper,
aws/ssm/parameter-not-found.ts(isParameterNotFoundError), which walks the cause chain (guarded against cycles) and treats an error as "parameter not found" if any error in the chain:name === 'ParameterNotFound'(current behaviour), or__type,Codeorcode) equal toParameterNotFoundafter the SDK's own normalisation (ns#Code:extra→Code), orErroror none) andmessage === 'ParameterNotFound'.The check stays narrow. Access denied, throttling,
ParameterVersionNotFoundand other errors are still rethrown, and a specifically named error (e.g.GetParameterError) is not matched on its message alone. Both the runner group cache store and the runner config consumer now use the helper.Workaround for affected deployments
Create the cache parameter by hand with the runner group ID:
/github-action-runners/<prefix>/<runner>/runners/config/runner-group/<group name>.Test Plan
parameter-not-found.test.ts: matches by name (direct and wrapped), by message on a genericError, and by__type/ namespaced__type/Code/code. It does not matchAccessDeniedException,ThrottlingException,ParameterVersionNotFound,InvalidKeyId, aGetParameterErrorthat only has the message, non-objects, or cyclic chains.runner-group-cache-store.test.ts: reproduces the production shape exactly (GetParameterErrorwrapping anErrornamedErrorwith messageParameterNotFound), plus a variant carrying__type. Both assert thatget()returnsundefinedand logs a cache miss. A negative test checks that a genericErrorwith a different code is still rethrown. The existingreturns undefined only for ParameterNotFoundandpropagates access and service errorstests are unchanged and pass.runner-config-consumer.test.ts: keeps polling when the SDK reports a missing parameter as a genericError.cd lambdas && yarn install && yarn format-check && yarn lint && yarn test: lint passes for all 11 projects, and all 1422 tests pass (storage-providers: 161).Related Issues
Regression from the runner group cache store extraction in #5355.