{"record":{"id":"88674f54748865a0","repo":"prestodb/presto","slug":"failed-to-get-query-details","errorCode":null,"errorMessage":"failed to get query details","messagePattern":"failed to get query details","errorType":"console","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"presto-ui/src/components/Splits.tsx","lineNumber":140,"sourceCode":"        if (timerid.current !== 0) {\n            clearTimeout(timerid.current);\n            timerid.current = 0;\n        }\n        const newQueryState = { query, ended: query.finalQueryInfo, failed: false };\n        if (newQueryState.ended === false && newQueryState.failed === false && timerid.current === 0) {\n            timerid.current = window.setTimeout(queryResult, 3000);\n        }\n\n        updateTimeline();\n        setQueryState(newQueryState);\n    }\n\n    function queryResult() {\n        const queryId = getFirstParameter(window.location.search);\n        fetch(\"/v1/query/\" + queryId)\n            .then((response) => {\n                if (!response.ok) {\n                    throw new Error(\"failed to get query details\");\n                }\n                return response.json();\n            })\n            .then((query) => {\n                calculateItemsGroups(query);\n            })\n            .catch((err) => {\n                console.log(`query failed with error: ${err}`);\n                setQueryState({ failed: true });\n            });\n    }\n\n    useEffect(() => {\n        queryResult();\n    }, [containerRef]);\n\n    return (\n        <>","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-ui/src/components/Splits.tsx#L122-L158","documentation":"In the Presto web UI's Splits component, queryResult fetches /v1/query/{queryId} and throws a plain Error(\"failed to get query details\") when the HTTP response is not ok. The rejection propagates to the fetch chain's catch, so the UI cannot render split details for that query.","triggerScenarios":"Opening the splits page with a queryId that no longer exists (query expired/evicted from coordinator memory), the coordinator returning 404/500, or the UI being pointed at a coordinator that does not know the query.","commonSituations":"Bookmarking/refreshing a splits page after query completion and query.max-history expiry; coordinator restart; load balancer routing the UI request to the wrong coordinator.","solutions":["Re-run the query and navigate to the splits page for the new query ID.","Check the coordinator logs for the query ID and any /v1/query errors.","Increase query.max-history / query.max-age if you need old query pages to keep working.","Confirm the UI's requests reach the correct coordinator (reverse-proxy routing)."],"exampleFix":"// before\nif (!response.ok) {\n    throw new Error(\"failed to get query details\");\n}\n// after\nif (!response.ok) {\n    throw new Error(`failed to get query details: HTTP ${response.status} for query ${queryId}`);\n}","handlingStrategy":"try-catch","validationCode":"// TypeScript: check the query id exists in the URL before fetching\nconst queryId = getFirstParameter(window.location.search);\nif (!queryId || !/^[\\w-]+$/.test(queryId)) {\n    showStatus(Status.FAIL); return;\n}","typeGuard":"function isValidQueryId(v: string | null): v is string {\n    return v !== null && /^[A-Za-z0-9._-]+$/.test(v);\n}","tryCatchPattern":"fetch(`/v1/query/${queryId}`)\n    .then((r) => { if (!r.ok) throw new Error(`HTTP ${r.status} for query ${queryId}`); return r.json(); })\n    .catch((err) => {\n        console.error(err.message);\n        showStatus(Status.FAIL); // surface a friendly UI state\n    });","preventionTips":["Handle 404/410 gracefully — old query IDs expire from coordinator memory.","Raise query.max-history if users bookmark completed queries.","Show a human-readable 'query expired' message instead of a blank page.","Verify UI and coordinator are served by the same host/proxy."],"tags":["web-ui","http","fetch","typescript"],"backgroundTag":"http-request-failed","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}