{"record":{"id":"9befe2f0a5c472d7","repo":"jackwener/OpenCLI","slug":"fetch-error-9befe2","errorCode":"FETCH_ERROR","errorMessage":"ONES worklog: all endpoints failed (last: ${lastDetail})","messagePattern":"ONES worklog: all endpoints failed \\(last: (.+?)\\)","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/ones/worklog.js","lineNumber":266,"sourceCode":"                        ];\n                    }\n                    lastDetail = `no effect (total_manhour ${String(beforeTotal)} -> ${String(afterTotal)})`;\n                    continue;\n                }\n                // If verification read fails, return success conservatively.\n                return [\n                    {\n                        task: taskId,\n                        date: dateStr,\n                        hours: String(hoursHuman),\n                        owner: ownerId,\n                        endpoint: path,\n                    },\n                ];\n            }\n            lastDetail = fail;\n        }\n        throw new CliError('FETCH_ERROR', `ONES worklog: all endpoints failed (last: ${lastDetail})`);\n    },\n});\n","sourceCodeStart":248,"sourceCodeEnd":269,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/ones/worklog.js#L248-L269","documentation":"This FETCH_ERROR is thrown by the ONES worklog command after it tried every candidate worklog API endpoint and each failed; the message includes the last failure detail. It aggregates multiple endpoint attempts into one terminal error because ONES worklog APIs vary across deployments/versions.","triggerScenarios":"All worklog endpoints return errors — e.g. invalid owner/task uuid, insufficient permissions to write worklogs, expired auth, or the ONES instance exposes none of the supported endpoint shapes.","commonSituations":"Restricted accounts that lack worklog write permission; wrong org/host configuration; ONES server version whose worklog API differs; stale session cookies.","solutions":["Read the `last:` detail in the message to see the underlying failure (401 → re-auth; 403 → permissions).","Re-authenticate / refresh the ONES token, then retry.","Verify the owner and task uuids are valid and the account can log work in the ONES web UI.","Check ONES_* env vars (host/org) point to the correct instance; if it persists, report the ONES server version since endpoint shapes vary."],"exampleFix":"// before\nopencli ones worklog <taskUUID> 2 --team T1   // 401 from stale cookie\n// after\nopencli ones login && opencli ones worklog <taskUUID> 2 --team T1","handlingStrategy":"retry","validationCode":"const probe = await onesFetchInPage(page, 'auth/token_info');\nif (!probe?.user?.uuid) throw new Error('Session invalid — re-authenticate before logging work.');","typeGuard":"function isRetryableWorklogFailure(e) { return e.code === 'FETCH_ERROR' && /all endpoints failed/.test(e.message); }","tryCatchPattern":"try {\n  await opencli.ones.worklog({ task, hours, team });\n} catch (e) {\n  if (e.code === 'FETCH_ERROR' && /all endpoints failed/.test(e.message)) {\n    console.error(e.message); // inspect `last:` detail\n    await refreshAuth();\n    return retryWithBackoff(() => opencli.ones.worklog({ task, hours, team }), 2);\n  }\n  throw e;\n}","preventionTips":["Parse the `last:` detail to distinguish auth (401), permission (403), and shape errors.","Re-authenticate before batch worklog operations.","Verify worklog write access in the ONES web UI for the account.","Pin/test against your ONES server version since worklog endpoints vary."],"tags":["api","network","auth","ones","endpoint"],"backgroundTag":"all-api-endpoints-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}