Skip to content

Error Codes

skret uses structured exit codes to communicate failure types. Every error includes a machine-readable code and a human-readable message on stderr.

CodeConstantMeaningRemediation
0ExitSuccessOperation completed successfully
1ExitGenericErrorUnclassified errorCheck the error message. File a bug if unexpected.
2ExitConfigErrorConfiguration problemVerify .skret.yaml exists, has valid syntax, and version: "1". Run skret init if missing.
3ExitProviderErrorBackend provider failureCheck provider connectivity. For AWS: verify region, check SSM service status.
4ExitAuthErrorAuthentication failedVerify credentials. For AWS: run aws sts get-caller-identity. Check IAM policy grants SSM access to the path.
5ExitNotFoundErrorSecret does not existVerify the key name with skret list. Check you are targeting the correct environment (--env).
6ExitConflictErrorResource conflictKey already exists when using --on-conflict=fail. Use --on-conflict=overwrite or --on-conflict=skip.
7ExitNetworkErrorNetwork/connectivity failureCheck internet connection, DNS resolution, and firewall rules. For AWS: verify VPC endpoints if in a private subnet.
8ExitValidationErrorInput validation failedCheck value size (4 KB limit for SSM Standard), key format, and required fields.
9ExitDriftDrift detected between two secret setsskret diff <A> <B> --exit-code found a difference. Review the diff output and re-sync with skret sync or skret import as needed.
10ExitLeakFoundA managed secret value was found in a scanned fileskret scan (or skret scan --staged) found a real secret value in a tracked file. Remove the value from the file, rotate the secret if it was committed, and re-run the scan.
125ExitExecErrorProcess execution errorThe command passed to skret run -- could not be executed. Verify the command exists in $PATH.

Errors from the pkg/skret library are typed as *skret.Error:

type Error struct {
Code int // Exit code from the table above
Message string // Human-readable description
Err error // Wrapped underlying error
}

Extract the exit code programmatically:

import "github.com/n24q02m/skret/pkg/skret"
client, err := skret.New()
if err != nil {
code := skret.ExitCode(err) // Returns the structured exit code
fmt.Fprintf(os.Stderr, "exit %d: %v\n", code, err)
os.Exit(code)
}
#!/bin/bash
set -e
skret get DATABASE_URL > /dev/null 2>&1
code=$?
case $code in
0) echo "Secret exists" ;;
2) echo "Config error -- run skret init" ;;
4) echo "Auth error -- check AWS credentials" ;;
5) echo "Secret not found" ;;
*) echo "Unexpected error (code $code)" ;;
esac
AWS Errorskret CodeDescription
ParameterNotFound5Secret key does not exist at the given path
AccessDeniedException3IAM policy denies the operation, surfaced as a generic provider error
ThrottlingException3API rate limit exceeded (40 TPS default); retried internally (see below), then surfaced as a generic provider error if it persists
ValidationException3Invalid parameter name or value too large, surfaced as a generic provider error
InternalServerError3AWS service error, surfaced as a generic provider error

skret configures the AWS SDK’s adaptive-mode retryer with up to 10 attempts and a 20-second max backoff (more than the SDK’s 3-attempt default, since SSM PutParameter is throttled at roughly 3 requests per second per account) before a persisting ThrottlingException surfaces as the provider error above.

These mappings apply uniformly across commands, including get: a missing key surfaces as exit 5 (not found), and any other provider failure surfaces as exit 3 — the same as set, env, run, sync, and the rest.

For any error, enable debug logging to see the full context:

Terminal window
SKRET_LOG=debug skret get MY_SECRET

This prints configuration resolution (the selected provider and path) to stderr at the debug level. Set SKRET_LOG_FORMAT=json for structured output. Secret values are never written to logs — the logger redacts value attributes.