Skip to content

OpenBao “wrapping token is not valid or does not exist”

Securitytested on OpenBao v2.7.1

Response wrapping packs a response into a single-use token. After the first unwrap it is used up. If your very first attempt fails, someone else unwrapped it before you – then it is not a bug but an alarm.

Symptom

WRAP=$(bao write -wrap-ttl=5m -field=wrapping_token -f \
  auth/approle/role/webshop/secret-id)
bao write sys/wrapping/lookup token=$WRAP
SECRET_ID=$(BAO_TOKEN=$WRAP bao unwrap -field=secret_id); echo $SECRET_ID
BAO_TOKEN=$WRAP bao unwrap
Key              Value
---              -----
creation_path    auth/approle/role/webshop/secret-id
creation_time    2026-10-08T09:00:48.524487+02:00
creation_ttl     5m
b5e26b57-4ac3-8426-5a25-3b11bbe9f959
Error unwrapping: Error making API request.
Code: 400. Errors:

* wrapping token is not valid or does not exist

The first unwrap returns the secret ID, the second fails.

Diagnosis

Before unwrapping, check that the token exists and comes from the expected path.

bao write sys/wrapping/lookup token=$WRAP

Causes

unwrapAlready unwrapped

A wrapping token is valid exactly once. A second unwrap – even by yourself – always fails.

wrap-ttlExpired

With -wrap-ttl=5m the token expires after five minutes, unwrapped or not.

InterceptedSomeone else was faster

If your first unwrap fails, someone else unwrapped the token on the way. Making exactly that visible is the point of wrapping.

Fix

Request a new wrapping token, check creation_path with sys/wrapping/lookup and unwrap it only once. If the first unwrap of a fresh token fails, revoke the affected secret ID and investigate the delivery path.

Don't: Do not drop wrapping because it is “annoying” – without it you never notice that a secret was read on the way.

▶
Break it yourself and find it – free
OpenBao hands-on, Day 3: response wrapping – hand over secret IDs safely and detect tampering.
Go to day 3 →

FAQ

Can I wrap KV responses too?

Yes, any response: bao kv get -wrap-ttl=2m … returns a wrapping token instead of the values.

Why lookup before unwrap?

lookup shows creation_path; if the path is wrong, someone slipped in a foreign token.

Related error patterns

More