Skip to content

Fix 500 when every wiki page link fails to resolve - #24770

Open
jtauschl wants to merge 1 commit into
opf:devfrom
jtauschl:fix/wiki-page-links-empty-metadata-sql-crash
Open

Fix 500 when every wiki page link fails to resolve#24770
jtauschl wants to merge 1 commit into
opf:devfrom
jtauschl:fix/wiki-page-links-empty-metadata-sql-crash

Conversation

@jtauschl

Copy link
Copy Markdown

Summary

Fixes the crash described in OP-19928 (points 2 and 3 of that report -- point 1's original framing about identifier semantics has been corrected in a follow-up comment there and does not apply to this fix).

When every link's identifier fails to resolve via the page-info query, metadata ends up empty. enrich_models still tried to build a LEFT JOIN (VALUES #{placeholders}) with zero placeholders, producing the invalid SQL fragment LEFT JOIN (VALUES ) and crashing with a Postgres syntax error, instead of returning the links with a nil title (which is what already happens for any individual link whose resolution fails when at least one other link in the same request succeeds).

Change

Return the relation directly with a NULL title column when metadata is empty, matching the shape callers already get from the non-empty path.

Test plan

  • Added a regression spec covering the case where every page link fails to resolve
  • Verified live against a real 17.7.1 instance: before the fix, GET on a work package with one unresolvable-identifier link returned 500; after the fix, it returns 200 with the link's title absent

When every link's identifier fails to resolve via the page-info query,
metadata ends up empty; enrich_models still tried to build a
LEFT JOIN (VALUES #{placeholders}) with zero placeholders, producing
the invalid SQL fragment "LEFT JOIN (VALUES )" and crashing with a
Postgres syntax error instead of returning the links with a nil title
(which is what happens for any individual link whose resolution
fails when at least one other link in the same request succeeds).

Return the relation directly with a NULL title column when metadata
is empty, matching the shape callers already get from the non-empty
path.
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@jtauschl

Copy link
Copy Markdown
Author

recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant