{"record":{"id":"1a4bd8f965c4f527","repo":"kubernetes/minikube","slug":"network-response-was-not-ok","errorCode":null,"errorMessage":"Network response was not ok","messagePattern":"Network response was not ok","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"hack/jenkins/test-flake-chart/flake_chart.js","lineNumber":788,"sourceCode":"      await new Promise(resolve => google.charts.setOnLoadCallback(resolve));\n\n      let url;\n      const basePath = 'https://gopogh-server-tts3vkcpgq-uc.a.run.app' // Base Server Path. Modify to actual server path if deploying\n      if (desiredEnvironment === undefined) {\n          // URL for displaySummaryChart\n          url = basePath + '/summary'\n      } else if (desiredTest === undefined) {\n          // URL for displayEnvironmentChart\n          url = basePath + '/env' + '?env=' + desiredEnvironment + '&tests_in_top=' + desiredTestNumber;\n      } else {\n          // URL for displayTestAndEnvironmentChart\n          url = basePath + '/test' + '?env=' + desiredEnvironment + '&test=' + desiredTest;\n      }\n\n      // Fetch data from the determined URL\n      const response = await fetch(url);\n      if (!response.ok) {\n          throw new Error('Network response was not ok');\n      }\n      const data = await response.json();\n      console.log(data)\n\n      // Call the appropriate chart display function based on the desired condition\n      if (desiredTest == undefined && desiredEnvironment === undefined) {\n          displaySummaryChart(data)\n      } else if (desiredTest === undefined) {\n          createTopnDropdown(currentTopn);\n          displayEnvironmentChart(data, query);\n      } else {\n          displayTestAndEnvironmentChart(data, query);\n      }\n      url = basePath + '/version'\n\n      const verResponse = await fetch(url);\n      if (!verResponse.ok) {\n          throw new Error('Network response was not ok');","sourceCodeStart":770,"sourceCodeEnd":806,"githubUrl":"https://github.com/kubernetes/minikube/blob/a899afc0eb0b122b323c7ea5ba8e31e3b4ca4b8e/hack/jenkins/test-flake-chart/flake_chart.js#L770-L806","documentation":"This error is thrown by flake_chart.js after `fetch(url)` completes but `response.ok` is false, meaning the gopogh server answered with an HTTP 4xx/5xx status. The URL is built from the hardcoded basePath ('https://gopogh-server-tts3vkcpgq-uc.a.run.app') plus '/summary', '/env?env=...&tests_in_top=...', or '/test?env=...&test=...' depending on which chart was requested. It is a transport-level success but an application-level failure: the endpoint exists at the HTTP layer yet rejected the request. Note that a DNS failure or CORS block throws a TypeError from fetch instead, so this message specifically indicates the server responded with an error status.","triggerScenarios":"Opening the flake chart page with no env/test filters (GET {basePath}/summary), with an environment filter (GET {basePath}/env?env=<name>&tests_in_top=<n>), or with both env and test (GET {basePath}/test?env=<name>&test=<test>) and the server returning 404 (unknown env/test name or undeployed Cloud Run service), 400 (invalid tests_in_top value), or 5xx (gopogh-server crash).","commonSituations":"The hardcoded Cloud Run URL in flake_chart.js:773 is stale or the service was renamed/undeployed; a test or environment name in the query string does not match what the server has (e.g. a job renamed in Jenkins); the gopogh-server version deployed does not implement the /env or /test routes; transient Cloud Run cold-start failures.","solutions":["Open the exact failing URL (e.g. https://gopogh-server-tts3vkcpgq-uc.a.run.app/summary) in a browser or with curl to see the raw status code and body.","If it is 404/503 from Cloud Run, update basePath at flake_chart.js:773 to the current gopogh-server deployment URL.","If it is 404/400 on /env or /test, verify the env= and test= values against the names the server actually stores (check the /summary response) and fix the chart page's query parameters.","Redeploy or upgrade gopogh-server so all three routes (/summary, /env, /test) are served.","Improve the error to include response.status and response.statusText so future hits are diagnosable."],"exampleFix":"// before\nconst response = await fetch(url);\nif (!response.ok) {\n    throw new Error('Network response was not ok');\n}\n\n// after\nconst response = await fetch(url);\nif (!response.ok) {\n    throw new Error(`Request to ${url} failed: ${response.status} ${response.statusText}`);\n}","handlingStrategy":"try-catch","validationCode":"async function assertEndpointOk(basePath, pathAndQuery) {\n  const probe = await fetch(basePath + pathAndQuery, { method: 'HEAD' });\n  if (!probe.ok && probe.status !== 405) {\n    throw new Error(`Pre-check failed for ${pathAndQuery}: ${probe.status}`);\n  }\n}\n// before the real fetch:\n// await assertEndpointOk(basePath, '/summary');","typeGuard":"function isHttpResponseError(err) {\n  return err instanceof Error && /failed: \\d{3}/.test(err.message);\n}","tryCatchPattern":"try {\n  const response = await fetch(url);\n  if (!response.ok) {\n    throw new Error(`Request to ${url} failed: ${response.status} ${response.statusText}`);\n  }\n  const data = await response.json();\n} catch (err) {\n  if (err instanceof TypeError) {\n    displayError(new Error(`Cannot reach gopogh server at ${basePath} (network/CORS)`));\n  } else {\n    displayError(err);\n  }\n}","preventionTips":["Keep basePath in flake_chart.js:773 as a deploy-time configuration value instead of a hardcoded Cloud Run URL, and update it whenever gopogh-server is redeployed.","Surface response.status and response.statusText in every thrown error so failures are self-describing.","Cross-check env= and test= query values against the names returned by /summary before requesting /env or /test.","Distinguish fetch() TypeError (unreachable host / CORS) from !response.ok (server rejected the request) in the error path."],"tags":["network","fetch","javascript","gopogh","http","jenkins"],"backgroundTag":null,"analyzedSha":"a899afc0eb0b122b323c7ea5ba8e31e3b4ca4b8e","analyzedAt":"2026-08-15T17:03:09.721Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}