{"record":{"id":"db7e21712492bdb8","repo":"jackwener/OpenCLI","slug":"result-detail-db7e21","errorCode":null,"errorMessage":"${result.detail}","messagePattern":"\\$\\{result\\.detail\\}","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/reddit/reply.js","lineNumber":172,"sourceCode":"          return { kind: 'postcondition', detail: 'Reddit comment response did not include a created reply id' };\n        }\n        return { kind: 'ok', detail: 'Reply posted on ' + fullname + ' as ' + createdName };\n      } catch (e) {\n        return { kind: 'exception', detail: String(e && e.message || e) };\n      }\n    })()`);\n\n        if (result?.kind === 'auth') {\n            throw new AuthRequiredError('reddit.com', result.detail);\n        }\n        if (result?.kind === 'http') {\n            throw new CommandExecutionError(`HTTP ${result.httpStatus} from ${result.where}`);\n        }\n        if (result?.kind === 'reddit-error') {\n            throw new CommandExecutionError(`Reddit rejected reply: ${result.detail}`);\n        }\n        if (result?.kind === 'postcondition') {\n            throw new CommandExecutionError(result.detail);\n        }\n        if (result?.kind === 'exception') {\n            throw new CommandExecutionError(`Reply failed: ${result.detail}`);\n        }\n        if (result?.kind !== 'ok') {\n            throw new CommandExecutionError(`Unexpected result from reddit reply: ${JSON.stringify(result)}`);\n        }\n        return [{ status: 'success', message: result.detail }];\n    },\n});\n","sourceCodeStart":154,"sourceCodeEnd":183,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/reddit/reply.js#L154-L183","documentation":"Thrown by the reddit `reply` command for postcondition failures: the reply action reported an unexpected end state (result.kind === 'postcondition'), e.g. the comment was submitted but could not be verified to exist afterwards. The raw `result.detail` is used as the message because it already describes the failed postcondition. It signals a verification/integrity failure rather than an HTTP or auth problem.","triggerScenarios":"Calling the reddit reply command when the page evaluate returns kind 'postcondition' — typically when the code checks that the new comment actually appears (e.g. fetching the comment permalink or the user's latest comment) and the verification fetch fails or returns nothing.","commonSituations":"Reddit accepting the POST but the verification GET being rate-limited or slow; new comments not immediately visible due to caching or spam filtering; race conditions in automated posting loops.","solutions":["Inspect `result.detail` to see which postcondition check failed","Retry the reply after a short delay, then check your profile's comment list to see if it was actually created","Avoid immediately re-posting on failure — the comment may exist, causing duplicates","Wrap the call in a try/catch and log the detail for diagnosis"],"exampleFix":"// before\nawait cli.run('reddit reply', { 'post-id': id, text });\n// after\ntry {\n  await cli.run('reddit reply', { 'post-id': id, text });\n} catch (e) {\n  console.error('Postcondition failure:', e.message); // verify before retrying\n}","handlingStrategy":"retry","validationCode":"// Nothing to validate pre-call; plan a verification step after:\nconst before = await getMyLatestCommentId();","typeGuard":"function isPostconditionResult(r) {\n  return r != null && typeof r === 'object' && r.kind === 'postcondition' && typeof r.detail === 'string';\n}","tryCatchPattern":"try {\n  await cli.run('reddit reply', { 'post-id': postId, text });\n} catch (e) {\n  if (/Reply failed|postcondition/i.test(e.message)) {\n    await sleep(3000);\n    if (!(await commentExists(postId, before))) await retryOnce(); // avoid duplicates\n  } else throw e;\n}","preventionTips":["Verify whether the comment actually exists before retrying (avoid duplicates)","Back off before retries — verification fetches may be rate-limited","Log result.detail to know which postcondition failed"],"tags":["reddit","postcondition","verification"],"backgroundTag":"postcondition-verification-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}