invalid next token error when using Nomad /v1/jobs pagination
29K reputation · 11 Dec 2021, 22:06 UTC
When paginating Nomad job listings via the /v1/jobs endpoint, supplying a malformed or expired next_token produces a 400 Bad Request response whose JSON payload includes the error message invalid next token. The Nomad documentation notes that this exact string may change between releases, advising clients to treat any non‑200 response as an error rather than depending on the specific text.
Given this uncertainty, developers must decide whether to implement special handling based on the error string (e.g., to differentiate token‑related failures from other 400 cases such as an invalid limit) or to rely solely on the HTTP status code and treat all 400 responses uniformly.
What is the recommended approach for distinguishing token‑related errors from other client errors in Nomad’s pagination API? Should client code inspect the invalid next token substring, or is checking the 400 status sufficient for robust error handling?
1 answer
0 question comments
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.