Conversation
… something other than JSON The atlassian client returns a 2xx body it cannot parse as JSON as text and an empty body as None. The v2 listing read that as a JSON object, so a base URL landing on a login/SSO page or the web UI failed the connection check with only "Failed to connect to find any Confluence space: AttributeError". The listing now raises a UserError naming the sanitized URL, the API path and what came back, points at the base URL and auth type, and says spaces and pages are listed through the Confluence Cloud REST API v2. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
No issues found across 4 files
Shadow auto-approve: would not auto-approve. This PR does not meet the repository auto-approval settings.
Re-trigger cubic
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Confluence connection check could fail with only this:
Cause: atlassian-python-api 4.0.7 (
AtlassianRestAPI.get()) does not raise when a 2xx response is not JSON. It returns the body as a string (response.text), orNonewhen the body is empty. Only 4xx/5xx responses raiseHTTPError.ConfluenceIndexer._paginate_v2_resultsthen calledresponse.get("results", [])on that string orNone, or on a JSON list, which raisedAttributeError.precheckwraps every unexpected exception withsafe_error_summary, which keeps only the exception type name, so the cause was lost.This happens when the base URL leads to a login or SSO page, to the web UI, or to anything else that answers 200 with a body that is not JSON.
Fix:
_paginate_v2_resultsnow raises aUserErrorwheneverclient.get()returns something other than a JSON object. The v2 listing is shared by the space check, the configured-space lookup and the page listing. The error message:DataSanitizer.sanitize_urlhttps://<site>.atlassian.net/wiki) and the auth typeThe response body is never echoed.
precheckalready re-raisesUnstructuredIngestErroras is, so the message reaches the connection check intact.Example:
Version bump: 1.11.20 to 1.11.21 (patch), with a CHANGELOG entry.
Production evidence
Production check-executioner logs show five connection-check attempts on a self-hosted (not
*.atlassian.net) Confluence URL. All five failed withFailed to connect to find any Confluence space: AttributeError. The traceback ends at theraise UserError(inprecheck, and the code path is the same as in the 1.11.12 release the index plugin locks. A sixth attempt gotHTTPError(status_code=404). The original exception is suppressed withfrom None, so the logs cannot tell an HTML body from an empty one. The new message states which one it was.Proof
Repro. The new tests fail on origin/main. I restored only
confluence.pyand__version__.pyfrom origin/main:With the fix:
test_confluence.py.make check-versionwas not run locally, becausescripts/version-sync.shneeds GNU sed 4.3 or later. I checked by hand that the CHANGELOG heading[1.11.21]matches__version__.Tests (mocked at
HTTPAdapter.send, so they run the real atlassian client parsing):UserErrorthat names the URL, the path and what came back, and never mentionsAttributeError.SND test plan
Nothing reaches users until the index plugin moves off its unstructured-ingest 1.11.12 lock. To test on an SND:
text/htmlon every path, and another that answers 200 with an empty body.Unexpected response from Confluence at http://<svc> (api/v2/spaces): expected a JSON object but got an HTML pageand should not containAttributeError.but got an empty body.Follow-ups (not in this PR)
HTTPError(status_code=404).SND verification
Not run. There is no Confluence instance on the trevor-biogen2 SND, and this pass did not build an index plugin with this branch's wheel. The SND test plan above is still open.
🤖 Generated with Claude Code