Immutable solution version
atlassian-python-api `delete_space` on a missing space raises generic ApiError instead of ApiNotFoundError
Complete solution
You were right: the library was swallowing the 404 into a generic `ApiError`. The maintainer agreed and wired `delete_space` (and the error handling around it) to raise `ApiNotFoundError` for the 404 case, landing in a commit on 2026-08-16.
atlassian-python-api delete_space on a missing space raises generic ApiError instead of ApiNotFoundError
What is going on
When I call delete_space on a Confluence instance with a space key that does not exist, the library raises a generic ApiError instead of ApiNotFoundError. I have to catch ApiError and drill into e.reason.response.status_code to discover it is a 404. Shouldn't a missing space raise ApiNotFoundError?
What actually works
You were right: the library was swallowing the 404 into a generic ApiError. The maintainer agreed and wired delete_space (and the error handling around it) to raise ApiNotFoundError for the 404 case, landing in a commit on 2026-08-16. So on a current version you can do the clean thing: try: client.delete_space(key) except ApiNotFoundError: pass. One caveat from the thread: delete_space can also return a 409 (conflict) in some cases, so keep a broader except ApiError fallback around it for non-404 failures.
Source: https://github.com/atlassian-api/atlassian-python-api/issues/980
Source
Mined from a verified thread: https://vectle.com/threads/thr_afIeLxbe4tCvNi6SW-uZjw (original: https://github.com/atlassian-api/atlassian-python-api/issues/980)
Evidence
In the thread, the asker reported: When I call delete_space on a Confluence instance with a space key that does not exist, the library raises a generic ApiError instead of ApiNotFoundError. I have to catch ApiError and drill into e.reason.response.status_code to discover it is a 404. Shouldn't a missing space raise ApiNotFoundError? The verified answer that resolved it: You were right: the library was swallowing the 404 into a generic ApiError. The maintainer agreed and wired delete_space (and the error handling around it) to raise ApiNotFoundError for the 404 case, landing in a commit on 2026-08-16. So on a current version you can do the clean thing: try: client.delete_space(key) except ApiNotFoundError: pass. One caveat from the thread: delete_space can also return a 409 (conflict) in some cases, so keep a broader except ApiError fallback around it for non-404 failures.
Source: https://github.com/atlassian-api/atlassian-python-api/issues/980 Thread: https://vectle.com/threads/thr_afIeLxbe4tCvNi6SW-uZjw
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_LEHIFy0wFez55QsUdC4zsQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">atlassian-python-api `delete_space` on a missing space raises generic ApiError instead of ApiNotFoundError <span>— Vectle</span></a>