> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenetlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting

> Symptom → cause → fix for PII Engine (Enterprise) failures: 403 and 404 from VPC Lattice or the service, caller timeouts, Marketplace entitlement refusals, KMS AccessDenied, Object Lock and audit 503s, Lattice service lookup on EKS, ECS in a no-NAT VPC, CloudFormation and Aurora errors, Pending pods.

**How to use this page**: find the symptom, confirm the cause with the check, apply the fix. Startup refusals print one line to stderr — `tenet-pii-enterprise: error: <reason>` — and exit `2`; that line is the first thing to read. Request refusals are a fixed `403` to the caller, with the reason in the service's own log.

Diagnose a broken deployment — collects evidence read-only, matches it to this page, proposes a fix.

Diagnose my Tenet PII Engine (Enterprise) deployment using [https://docs.tenetlabs.com/pii-engine/troubleshooting](https://docs.tenetlabs.com/pii-engine/troubleshooting.md). Collect evidence read-only first; do not change anything until I approve a fix.

Ask me for: platform (EKS namespace + release, or ECS cluster/stack name and NamePrefix), Region, the symptom I'm seeing, and — if a caller is failing — the caller's role ARN, its VPC, the endpoint it calls and the HTTP status and body it gets.

Collect:

1. Service state: EKS `kubectl -n <ns> get pods -o wide`, `kubectl describe pod` for any non-Running pod, the last 100 log lines of each container (previous container too if restarting), `kubectl get httproute,accesslogpolicy -o wide`. ECS: `aws ecs describe-services`, the last 10 stopped tasks' `stoppedReason` and container exit codes, the last 100 lines of each service log group, and `aws vpc-lattice list-targets` for both target groups. CloudFormation: `aws cloudformation describe-stack-events` filtered to \*\_FAILED.
2. Any line starting `tenet-pii-enterprise: error:`, and any `refused … on route`, `kms:` error, `AWS Marketplace metering`, `on_reidentify hook failed`, `on_erase hook failed`, `vault unreachable`, `unbilled usage lost` line.
3. For a failing caller: the matching entries in the Lattice access logs (`/<NamePrefix>/lattice`, or the Helm access-log destination) for that principal in the last hour; the service auth policies (`aws vpc-lattice get-auth-policy --resource-identifier <service arn>`); the identity policies attached to the caller role (`aws iam list-attached-role-policies`, `list-role-policies`); the caller's security groups and whether its VPC is associated with the service network (`aws vpc-lattice list-service-network-vpc-associations`).
   Then match the evidence to a section of the troubleshooting page, quote the matching symptom, and propose the page's fix as exact commands. Wait for my approval before running any command that changes state. Never print secrets, request bodies, session ids or audit-record contents beyond their field names.

## Requests refused with 403

**Symptom.** A caller gets `403`. The client raises `TenetLatticeError(403, …)`.

**Find who refused.** Two layers refuse with a fixed `403`, and the body tells them apart:

* **VPC Lattice** refuses on the service's auth policy, before anything reaches a task. The body is Lattice's own, the request shows up in the Lattice access logs as denied (with the principal's tags), and the service logs nothing.
* **The service** re-checks every request Lattice forwards and answers `{"detail": "forbidden"}`. It logs the reason at WARNING: `refused <METHOD> on route <route>: <reason>`.

**Lattice refusals — causes, most common first:**

| Cause | Fix |
| - | - |
| The caller's role isn't in the invoker list for that route: `DetectInvokerRoleArns` (detect, redact, de-identify), `ErasureInvokerRoleArns` (`DELETE /sessions/…`), `RehydrateInvokerRoleArns` (reidentify) — or the Terraform / Helm equivalents | Add the **role** ARN to the right list and update the stack. An erasure from a role that's only a detect invoker is refused by design. |
| The caller's own IAM policy doesn't allow `vpc-lattice-svcs:Invoke` on the service | Attach the `DetectCallerPolicy` / `RehydrateCallerPolicy` output (Terraform: `detect_caller_policy` / `rehydrate_caller_policy`). A same-account caller needs this **and** the auth policy; either alone is denied. On EKS, write the equivalent statement against the service ARN. |
| The caller's VPC isn't in `AllowedSourceVpcIds` / `allowed_source_vpc_ids` / `lattice.allowedSourceVpcIds` | Add it, and associate that VPC with the service network. |
| `RequireRehydrateApprovalTag` is on and the role session has no `tenet-approval-id` tag | Have the approval workflow assume the invoker role with `sts:TagSession`. Check the tag in the denied access-log entry. |
| The request isn't signed for `vpc-lattice-svcs` in the service's Region, or is signed with expired credentials | Sign with SigV4, service `vpc-lattice-svcs`, the stack's Region, header `x-amz-content-sha256: UNSIGNED-PAYLOAD`. The `tenet-pii-lattice` client does this and refreshes credentials. |

**Service refusals — the `<reason>` in the log:**

| Reason | Cause → fix |
| - | - |
| `<principal> is not allowed to call reidentify` (or `sessions`) | The role is in the auth policy but not in the service's own allow-list (`TENET_LATTICE_REIDENTIFY_PRINCIPALS` / `TENET_LATTICE_ERASE_PRINCIPALS`). The templates set both from the same input; if you edited an auth policy by hand, put the role in the stack input instead. |
| `non-canonical path` | Percent-encoding, a trailing slash, or empty or dot segments in the path. Send exactly `/reidentify`, `/sessions/<session_id>`, and so on. |
| `request targets a different Lattice service` | The task's service ARN doesn't match the Lattice service that forwarded the request — usually a hand-made service or route pointing at these targets. Route only through the stack's services. |
| `peer <address> is outside the Lattice ranges` | A request reached a task without passing through Lattice, or AWS added a Lattice range before the image knew it. Compare with the `com.amazonaws.<region>.vpc-lattice` prefix list; set `TENET_LATTICE_PEER_CIDRS` (Helm: `lattice.peerCidrs`) if it changed. |
| `identity Type is not AWS_IAM`, `expected exactly one … header` | The request didn't arrive as a signed IAM request through Lattice. Check the service's auth type is `AWS_IAM`. |

## Lattice answers 404

**Symptom.** `404` with a body that isn't `{"detail": "unknown or expired session_id"}`.

**Cause.** Each Lattice listener forwards only exact routes — detect: `POST /detect`, `POST /redact`, `POST /deidentify`, `DELETE /sessions/{session_id}`; rehydrate: `POST /reidentify` — and answers everything else with a fixed `404`. Typical misses: a trailing slash, upper-case letters, the wrong method, `/reidentify` sent to the detect endpoint, or `/healthz` and `/readyz` called through Lattice (they aren't routed; check readiness from ECS, the target groups or Kubernetes).

A `404` **with** `unknown or expired session_id` comes from the service: the session's TTL lapsed (1 h by default, sliding on writes) or it was erased. Start a new session.

## Callers time out

**Symptom.** Connections to `DetectEndpoint` / `RehydrateEndpoint` hang or the name doesn't resolve.

| Check | Fix |
| - | - |
| The caller's security group allows egress tcp/443 to the `com.amazonaws.<region>.vpc-lattice` prefix list | Attach `LatticeClientSecurityGroupId` / `lattice_client_security_group_id`, or add that egress rule. |
| The caller's VPC is associated with the service network (`ServiceNetworkArn` output) | Associate it. Lattice service names resolve only in associated VPCs. Callers in another account need the network or services shared with AWS RAM. |
| The caller runs in an AZ VPC Lattice supports | Lattice isn't offered in every AZ (for example `use1-az3`). Move the caller. |
| On EKS, only rehydrate callers time out, and nodes are `c9g` | The Graviton5 network-policy agent bug — see [EKS rehydrate callers blocked on Graviton5](#eks-rehydrate-callers-blocked-on-graviton5). |

## Entitlement check refuses startup

**Symptom.** The detect service exits at startup with one of (rehydrate doesn't check the subscription):

```text theme={null}
tenet-pii-enterprise: error: AWS Marketplace metering refused this deployment: <code>. Check that this account is subscribed to the product and that the task role allows aws-marketplace:MeterUsage.
tenet-pii-enterprise: error: AWS Marketplace metering is unreachable: <error>. Check the metering-marketplace VPC endpoint.
```

**Cause and fix.**

* **Refused** — the account isn't subscribed (or the subscription ended), the role lacks `aws-marketplace:MeterUsage` on `Resource: "*"`, or the credentials aren't the ECS task role or IRSA. AWS rejects node roles, EKS Pod Identity and long-term keys for this call. Subscribe from the deployment account (or accept the private offer there), grant the action to the detect role, and on EKS use IRSA through the `tenet-pii-enterprise-detect` ServiceAccount. [Billing and metering](https://docs.tenetlabs.com/pii-engine/concepts/billing.md).
* **Unreachable** — no `com.amazonaws.<region>.metering-marketplace` interface endpoint with private DNS, or its security group doesn't admit 443 from the tasks.

A `Marketplace entitlement check was throttled; starting anyway` warning isn't one of these refusals: AWS throttled the check.

## KMS AccessDeniedException at startup

**Symptom.** A service exits at startup with one of:

```text theme={null}
tenet-pii-enterprise: error: kms:Encrypt failed for key_id k…-… (pii-vault-private-key): AccessDeniedException     # detect, first start or rotate-key
tenet-pii-enterprise: error: kms:Decrypt failed for key_id k…-… (pii-vault-lookup-key): AccessDeniedException      # either service
tenet-pii-enterprise: error: kms:Decrypt failed for key_id k…-… (pii-vault-private-key): AccessDeniedException     # rehydrate
```

**Cause.** The purpose in parentheses names the statement that's missing or mismatched:

| Role | Must be allowed | Purposes |
| - | - | - |
| detect | `kms:Encrypt` | `pii-vault-lookup-key`, `pii-vault-private-key` |
| detect | `kms:Decrypt` | `pii-vault-lookup-key` |
| rehydrate | `kms:Decrypt` | `pii-vault-lookup-key`, `pii-vault-private-key` |

Almost always it's an **encryption-context mismatch**: the key policy or IAM condition pins a different `tenet:deployment` than the `TENET_DEPLOYMENT_ID` the service runs with, or misspells a purpose. Other causes: the role isn't in the key policy at all; or the `kms` VPC endpoint policy denies the key. A detect `Decrypt` denial on `pii-vault-private-key` is correct — the detect role must never have that.

**Check.**

```bash theme={null}
# What the service sends
kubectl -n tenet-pii get deploy tenet-tenet-pii-enterprise-detect -o jsonpath='{.spec.template.spec.containers[0].env}' | jq '.[] | select(.name=="TENET_DEPLOYMENT_ID")'
# What the key policy allows
aws kms get-key-policy --key-id "$CMK" --policy-name default --output text | jq '.Statement[] | {Sid, Effect, Action, Condition}'
# What CloudTrail saw
aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventSource,AttributeValue=kms.amazonaws.com \
  --max-results 20 --query 'Events[?contains(CloudTrailEvent, `AccessDenied`)].CloudTrailEvent' --output text \
  | jq -r '.eventName, .requestParameters.encryptionContext, .userIdentity.arn'
```

**Fix.** Make the statements match the table above, with your deployment id exactly — in the key policy **and** the role policy. Pin only `kms:EncryptionContext:tenet:purpose` and `kms:EncryptionContext:tenet:deployment`; `tenet:key_id` and `tenet:public_key` change with every key. The statements for an existing CMK are on the [CloudFormation page](https://docs.tenetlabs.com/pii-engine/deploy/ecs-cloudformation.md#bringing-your-own-kms-key). Never "fix" it by changing `TENET_DEPLOYMENT_ID` on an existing vault: that's refused (`vault keyring belongs to deployment 'a' but TENET_DEPLOYMENT_ID is 'b'; …`).

**`InvalidCiphertextException` instead of `AccessDeniedException`**, or `key pair for key_id … does not verify`: the wrapped key doesn't match its context — a different CMK than the one that wrapped the keyring, a vault restored into another deployment, or a keyring record someone changed (a swapped public key fails exactly here, by design). Point the services at the original CMK and deployment id; if the record was tampered with, treat it as a security incident.

## Rehydrate or detect refuses to start: Object Lock

**Symptom.** A service exits with one of:

```text theme={null}
tenet-pii-enterprise: error: the rehydrate role requires an audit sink: set TENET_AUDIT_S3_URI
tenet-pii-enterprise: error: the detect role requires an audit sink: set TENET_AUDIT_S3_URI
tenet-pii-enterprise: error: audit bucket '<bucket>' has no usable Object Lock configuration (AccessDenied); refusing to start without an immutable audit trail
tenet-pii-enterprise: error: audit bucket '<bucket>' does not have Object Lock enabled; refusing to start without an immutable audit trail
```

Both services audit — rehydrate writes reidentify records, detect writes erasure records — so both need the bucket.

**Fix.**

* **No audit sink** → set it: Helm `rehydration.auditS3Uri` and `lattice.erasureAuditS3Uri`; the templates set both.
* `(AccessDenied)` → grant the role `s3:GetBucketObjectLockConfiguration` on the bucket ARN (not `bucket/*`). `PutObject` alone isn't enough: the startup check reads the configuration.
* Not enabled / not found → Object Lock can only be turned on for a versioned bucket. Use a bucket created with Object Lock (the templates create one), or enable it: `aws s3api put-object-lock-configuration --bucket <b> --object-lock-configuration '{"ObjectLockEnabled":"Enabled","Rule":{"DefaultRetention":{"Mode":"COMPLIANCE","Days":2190}}}'` after enabling versioning.
* A **warning** `audit bucket <bucket> has Object Lock enabled but no default retention rule; …` doesn't stop startup, but your records aren't retention-locked. Add a default retention rule.

## Reidentify returns 503: audit failed

**Symptom.** `/reidentify` returns `503 {"detail": "reidentify audit failed; nothing was restored"}`; the rehydrate log shows `on_reidentify hook failed for request_id=<id>` with a traceback.

**Cause.** The audit record couldn't be written, so nothing was restored. Common causes, in order: the rehydrate role lost `s3:PutObject` on `<bucket>/<prefix>*`; the bucket's SSE-KMS key doesn't allow the role `kms:GenerateDataKey` via S3; the bucket policy's wrong-key deny (a different KMS key than the CMK); the S3 gateway endpoint was removed from the route table or its policy excludes the bucket.

**Fix.** Read the traceback's AWS error code, then restore the permission or route. The client should retry after the fix; no plaintext was returned and no partial state was written.

## Erasure returns 503: audit failed

**Symptom.** `DELETE /sessions/{session_id}` returns `503 {"detail": "erase audit failed; nothing was deleted"}`; the detect log shows `on_erase hook failed for request_id=<id>`.

**Cause and fix.** Same causes as above, for the **detect** role and the erasure prefix (`ErasureAuditPrefix`, default `erasure/`): `s3:PutObject` on `<bucket>/<erasure prefix>*`, `kms:GenerateDataKey` via S3, the S3 route. The session was kept; retry the erasure after the fix.

## Rehydrate refuses to start: empty keyring

**Symptom.** ``tenet-pii-enterprise: error: vault keyring is empty: start the detect role first or run `tenet-pii-enterprise rotate-key` ``.

**Fix.** Rehydrate waits up to two minutes for the detect service to create the first key pair, then gives up. Get the detect service running (its own startup error is the real cause), or run `rotate-key` once. Rehydrate never creates keys by design.

## Lattice service lookup fails on EKS

**Symptom.** Pods restart from their startup probe, or exit with one of:

```text theme={null}
tenet-pii-enterprise: error: no VPC Lattice service named '<name>' after 300s
tenet-pii-enterprise: error: 2 VPC Lattice services are named '<name>' (shared services count too); set TENET_LATTICE_SERVICE_ARN instead
tenet-pii-enterprise: error: vpc-lattice:ListServices failed (AccessDeniedException)
```

**Cause.** On EKS each pod looks up the Lattice service the AWS Gateway API Controller creates from its HTTPRoute, and waits up to 5 minutes for it.

**Fix.**

* **Not found** → the controller hasn't created the service. Check `kubectl describe httproute` and the controller's logs. In a cluster without NAT the controller needs the `com.amazonaws.<region>.vpc-lattice` **and** `com.amazonaws.<region>.tagging` endpoints; without `tagging`, route reconciliation times out and no service appears.
* **More than one** → a service with the same name exists in the account or is shared into it. Rename the release, or set `TENET_LATTICE_SERVICE_ARN` through `extraEnv`.
* **ListServices failed** → grant both IRSA roles `vpc-lattice:ListServices`, and make sure the `vpc-lattice` endpoint exists.

## Access logs stay at TargetNotFound (EKS)

**Symptom.** With `lattice.accessLogDestinationArn` set, `kubectl -n "$NS" get accesslogpolicy` shows `TargetNotFound` after the first install, and no Lattice access logs arrive.

**Fix.** The controller reconciled the AccessLogPolicies before it created the Lattice services, and doesn't retry. Once the HTTPRoutes carry the `application-networking.k8s.aws/lattice-assigned-domain-name` annotation, run `helm upgrade` once more; the policies then show `Accepted`.

## Invalid principal list at startup

**Symptom.** One of:

```text theme={null}
tenet-pii-enterprise: error: 'arn:aws:iam::<account-id>:user/alice' is not an IAM role ARN (arn:aws:iam::<account>:role/[<path>/]<name>); users, root and wildcards aren't accepted
tenet-pii-enterprise: error: TENET_LATTICE_REIDENTIFY_PRINCIPALS is required: the IAM role ARNs that may call /reidentify
```

**Fix.** Invoker lists take IAM **role** ARNs only — one entry matches every session of that role. Replace users, `root` and wildcards with roles your callers assume, and give rehydration at least one invoker role.

## TENET\_VAULT\_URL contains a password

**Symptom.** `tenet-pii-enterprise: error: TENET_VAULT_URL must not contain a password; supply it via PGPASSWORD (and PGUSER)`.

**Fix.** Remove the credentials from the URL — `postgresql://<host>:5432/tenet?sslmode=require` — and pass them as `PGUSER` / `PGPASSWORD` from a secret (Helm `vault.credentialsSecret`; the templates do this for you).

## Database credentials stop working after a few days (ECS)

**Symptom.** Tasks fail readiness, the log shows `vault unreachable: …`, de-identify fails — about 7 days after deploy.

**Cause.** The CloudFormation/Terraform stacks use the Aurora master secret, which RDS rotates every 7 days. ECS injected the old password at task start.

**Fix.** `aws ecs update-service --force-new-deployment` both services. Long term, create a dedicated database user for the engine with its own rotation schedule and point `ExistingVaultSecretArn` at it.

## ECS instances don't register in a no-NAT VPC

**Symptom.** The ASG launches instances, but the ECS cluster shows 0 container instances; services sit at 0 running tasks.

**Cause.** The ECS agent can't reach the control plane. In a VPC with no NAT it needs the `ecs`, `ecs-agent` and `ecs-telemetry` interface endpoints, plus `ecr.api`, `ecr.dkr`, the S3 gateway (image layers), `logs` and `sts` — all with **private DNS**.

**Check.** `aws ec2 describe-vpc-endpoints --filters Name=vpc-id,Values=<vpc> --query 'VpcEndpoints[].{S:ServiceName,DNS:PrivateDnsEnabled,State:State}'`. With `EnableSsmEndpoints=true`, `sudo journalctl -u ecs` on an instance shows the failing call.

**Fix.** Create the missing endpoints with private DNS (or set `CreateVpcEndpoints=true`).

## Lattice targets never become healthy (ECS)

**Symptom.** Tasks run, but `aws vpc-lattice list-targets` shows them `UNAVAILABLE` or `UNHEALTHY`, or registration fails.

**Fix.** Keep `PrivateSubnetIds` in AZs that VPC Lattice supports. Check that the task security groups admit tcp/19991 from the Lattice prefix list (`LatticePrefixListId` must be the `com.amazonaws.<region>.vpc-lattice` list). Unhealthy targets that are running are usually not ready — look for `vault unreachable` in their log.

## CloudFormation fails before creating anything

**Symptom.** `Requires capabilities : [CAPABILITY_AUTO_EXPAND]`, or the template is rejected for its size.

**Fix.** Add `CAPABILITY_AUTO_EXPAND` next to `CAPABILITY_NAMED_IAM` — the template uses the `AWS::LanguageExtensions` transform. The template is over CloudFormation's inline limit, so deploy it through an S3 bucket you own (`aws cloudformation deploy --s3-bucket`).

## Aurora engine version not offered

**Symptom.** `VaultCluster` fails with `Cannot find version … for aurora-postgresql`.

**Fix.** The default is `16.15`. List what your Region offers and pass one with `AuroraEngineVersion` / `aurora_engine_version`:

```bash theme={null}
aws rds describe-db-engine-versions --engine aurora-postgresql --region "$AWS_REGION" \
  --query "DBEngineVersions[?starts_with(EngineVersion,'16.')].EngineVersion" --output text
```

## c9g.xlarge not offered in the Region

**Symptom.** The ASG or node group fails to launch with an unsupported-instance-type error.

**Fix.** `c9g` isn't in every Region. Check with `aws ec2 describe-instance-type-offerings --location-type region --filters Name=instance-type,Values=c9g.xlarge`, and use `c8g.xlarge` (`InstanceType` / `instance_type`) where it's missing. On EKS, use `c8g.xlarge` anyway — see below.

## EKS rehydrate callers blocked on Graviton5

**Symptom.** On `c9g` nodes, some new rehydrate callers time out against one or both rehydrate pods, while others work.

**Cause.** The VPC CNI network policy agent can fail an eBPF map write with `ENOMEM` on Graviton5 and doesn't retry, so the caller stays blocked until the next policy change. It fails closed. Confirm on a node: `cannot allocate memory` in `/var/log/aws-routed-eni/network-policy-agent.log`. AWS tracks it as [aws-network-policy-agent issue 686](https://github.com/aws/aws-network-policy-agent/issues/686).

**Fix.** Run the chart on `c8g.xlarge` nodes, which the chart prefers. ECS isn't affected.

## EKS pods stuck Pending

**Symptom.** Detect pods `Pending` with `Insufficient cpu`.

**Cause.** A request of a full `cpu: 4` can't fit on a 4-vCPU node after the kubelet reserve and DaemonSets. Or a surge pod during a rollout has no node to go to.

**Fix.** Keep the chart's `3500m` request with a `4` limit — don't raise the request. For rollouts, keep `maxSurge: 0` unless an autoscaler or spare nodes exist. Check that nodes are `arm64` and not Fargate: `kubectl get nodes -L kubernetes.io/arch,eks.amazonaws.com/compute-type`.

## Half the capacity during deploys

**Symptom.** Latency rises and throughput halves during every rollout.

**Cause.** By design: ECS minimum healthy `50`% / maximum `100`% (and Helm `maxSurge: 0`) replace replicas in place, because each detect replica fills a node.

**Fix.** Deploy off-peak or scale up first; or set ECS `100`/`200` (with `AsgMaxSize` headroom) / Helm `maxSurge: 1`, `maxUnavailable: 0` with an autoscaler. [Upgrades](https://docs.tenetlabs.com/pii-engine/operate/upgrades.md#capacity-during-a-rollout).

## The image doesn't pull

**Symptom.** ECS tasks stop with `CannotPullContainerError`, or EKS pods sit in `ImagePullBackOff`.

**Cause.** AWS Marketplace serves the image only from its registry in `us-east-1`; a subscribed account gets "not entitled" from the registry in any other Region. Common causes:

* **A copy in your own ECR.** The templates point `ecr.api` and `ecr.dkr` at `us-east-1`, so the stack can't reach a copy in its own Region. Set `ImageUri` / `image_uri` / `image.repository` to the Marketplace image, by digest from the [release record](https://docs.tenetlabs.com/pii-engine/get-started/marketplace.md#verify-the-release).
* **Outside `us-east-1`, missing cross-Region endpoints.** The nodes need interface endpoints whose service Region is `us-east-1` for `com.amazonaws.us-east-1.ecr.api`, `com.amazonaws.us-east-1.ecr.dkr` and `com.amazonaws.us-east-1.s3` (the layers). The CloudFormation template and Terraform module create them unless `CreateVpcEndpoints=false` / `create_vpc_endpoints = false`; on EKS you create them. [Prerequisites](https://docs.tenetlabs.com/pii-engine/deploy/prerequisites.md#vpc-endpoints).
* **The stack couldn't create those endpoints.** Creating a cross-Region endpoint needs `vpce:AllowMultiRegion`. Administrator and PowerUser roles have it; a deploy role scoped to specific actions needs it added.
* **The layer endpoint's policy** doesn't allow `s3:GetObject` on `prod-us-east-1-starport-layer-bucket/*`.

## Stack delete hangs

**Symptom.** CloudFormation delete sits on the ECS services (`DRAINING`) or the Auto Scaling group, or ends `DELETE_FAILED` on a Lattice target group with "Exceeded attempts to wait".

**Cause.** If the VPC endpoints are removed while services still run, the ECS agent loses its path to the control plane and can't stop tasks. The template orders deletes to avoid this; it recurs when endpoints are external and were deleted first. The target-group failure happens when CloudFormation deletes it while ECS is still deregistering the tasks.

**Fix.** For the target group, delete the stack again. For a hang, remove scale-in protection from the ASG's instances, terminate them, then retry the delete.

## Other quick ones

| Symptom | Cause → fix |
| - | - |
| Pods or tasks not ready for minutes after start | Model loading; the startup probe allows 5 minutes. If it never finishes, check memory limits (≥ 3 GiB) and look for `vault not ready yet` / `vault unreachable after 120s`. |
| `409 concurrent deidentify writes to one session; retry the request` | Two writers on one session at once. Retry. |
| `400` on `/deidentify` mentioning `max_mappings_per_session` | 10,000 placeholders in one session. Use one session per document or conversation. |
| `/reidentify` returns some placeholders in `unresolved` | The text has placeholders this session never issued (often model-invented). Not an error. |
| `KMS VaultKey` fails with "invalid principals" during create | IAM propagation lag for just-created roles. Retry the stack operation. |
| `unbilled usage lost: …` in the detect log | AWS Marketplace didn't accept an hourly usage report. Check the `metering-marketplace` endpoint and `aws-marketplace:MeterUsage` on the detect role. |

## Links

* [Billing and metering](https://docs.tenetlabs.com/pii-engine/concepts/billing.md)
* [Prerequisites](https://docs.tenetlabs.com/pii-engine/deploy/prerequisites.md)
* [Monitoring](https://docs.tenetlabs.com/pii-engine/operate/monitoring.md)
* [Rehydration and audit](https://docs.tenetlabs.com/pii-engine/concepts/rehydration-and-audit.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.