{"record":{"id":"1b9ee4c34f9ddb44","repo":"ruvnet/ruflo","slug":"gupp-state-checksum-mismatch-possible-corrupti","errorCode":null,"errorMessage":"[GUPP] State checksum mismatch - possible corruption. Proceeding with caution.","messagePattern":"\\[GUPP\\] State checksum mismatch - possible corruption\\. Proceeding with caution\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/plugins/gastown-bridge/src/gupp/state.ts","lineNumber":390,"sourceCode":" * @returns Loaded state or empty state if not found\n */\nexport async function loadState(\n  statePath: string = DEFAULT_STATE_PATH\n): Promise<GuppState> {\n  try {\n    const content = await fs.readFile(statePath, 'utf-8');\n    const parsed = JSON.parse(content);\n\n    // Validate state structure\n    const validated = GuppStateSchema.parse(parsed);\n\n    // Verify checksum if present\n    if (validated.checksum) {\n      // Destructure to omit checksum for verification\n      const { checksum: _, ...stateWithoutChecksum } = validated;\n      const expectedChecksum = calculateChecksum(stateWithoutChecksum);\n      if (validated.checksum !== expectedChecksum) {\n        console.warn(\n          '[GUPP] State checksum mismatch - possible corruption. Proceeding with caution.'\n        );\n      }\n    }\n\n    return validated as GuppState;\n  } catch (error) {\n    if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n      // File doesn't exist, return empty state\n      return createEmptyState();\n    }\n\n    // Log error and return empty state\n    console.error('[GUPP] Failed to load state:', error);\n    return createEmptyState();\n  }\n}\n","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/plugins/gastown-bridge/src/gupp/state.ts#L372-L408","documentation":"Integrity check in loadState(): the persisted GUPP state file parsed and passed schema validation, but its recomputed checksum does not match the stored one — the file may be corrupted or hand-edited. The state is still returned (proceed with caution) rather than discarded.","triggerScenarios":"Persisted GUPP state fails checksum verification on load: partial write, disk corruption, or version skew; adapter proceeds cautiously rather than trusting the state.","commonSituations":"See trigger scenarios.","solutions":["Treat checksum mismatch as corruption: restore state from the last known-good snapshot or re-sync from source.","Investigate concurrent writers or partial writes that could corrupt the state file.","Add atomic write (write-temp-then-rename) to state persistence to prevent torn writes."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}