# SnapStart hook timed out: The runtime hook did not complete within 10 seconds.

- **ID:** `aws/lambda-snapstart-hook-timeout`
- **Domain:** aws
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 75%

## Root Cause

Lambda SnapStart initialization hook (e.g., for Java) exceeded the 10-second limit during snapshot creation.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| java-21 | active | — | — |
| snapstart-1.0 | active | — | — |
| aws-lambda-java-core-1.2.3 | active | — | — |

## Workarounds

1. **Optimize the initialization code in the `CRaC` or `beforeCheckpoint` hook: move heavy setup (e.g., DB connection pools) to lazy initialization after checkpoint.** (80% success)
   ```
   Optimize the initialization code in the `CRaC` or `beforeCheckpoint` hook: move heavy setup (e.g., DB connection pools) to lazy initialization after checkpoint.
   ```
2. **Use a smaller runtime or reduce classpath scanning: in Spring Boot, set `spring.context.initializer.exclude` to skip slow beans.** (70% success)
   ```
   Use a smaller runtime or reduce classpath scanning: in Spring Boot, set `spring.context.initializer.exclude` to skip slow beans.
   ```

## Dead Ends

- **** — Increasing Lambda timeout setting doesn't affect SnapStart hook timeout; the 10-second limit is fixed. (100% fail)
- **** — Disabling SnapStart entirely removes the performance benefit and doesn't fix the root cause. (50% fail)
