{"record":{"id":"39dd6072f9e41651","repo":"davila7/claude-code-templates","slug":"failed-to-decode-workflow-data-from-hash","errorCode":null,"errorMessage":"Failed to decode workflow data from hash","messagePattern":"Failed to decode workflow data from hash","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli-tool/src/index.js","lineNumber":2232,"sourceCode":"      const [shortHash, encodedData] = hash.split('_', 2);\n      \n      if (!encodedData) {\n        throw new Error('Invalid hash format: missing encoded data');\n      }\n      \n      // Decode compressed data\n      let decodedData;\n      try {\n        // First try to decompress the data (new compressed format)\n        const decompressedString = decompressString(encodedData);\n        decodedData = JSON.parse(decompressedString);\n      } catch (decompressError) {\n        // Fallback to old Base64 format for compatibility\n        try {\n          const decodedString = decodeURIComponent(escape(atob(encodedData)));\n          decodedData = JSON.parse(decodedString);\n        } catch (base64Error) {\n          throw new Error('Failed to decode workflow data from hash');\n        }\n      }\n      \n      // Validate decoded data structure\n      if (!decodedData.metadata || !decodedData.steps || !decodedData.components) {\n        throw new Error('Invalid workflow data structure in hash');\n      }\n      \n      console.log(chalk.green('✅ Workflow decoded successfully!'));\n      console.log(chalk.gray(`   Short hash: ${shortHash}`));\n      console.log(chalk.gray(`   Timestamp: ${decodedData.timestamp}`));\n      console.log(chalk.gray(`   Version: ${decodedData.version}`));\n      \n      // Convert to expected format\n      return {\n        name: decodedData.metadata.name,\n        description: decodedData.metadata.description,\n        tags: decodedData.metadata.tags || [],","sourceCodeStart":2214,"sourceCodeEnd":2250,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/index.js#L2214-L2250","documentation":"Final decode failure: the payload after '_' could not be decoded either as compressed data (primary path) or as legacy Base64 JSON (fallback via atob). Both attempts threw, so the hash payload is corrupt or uses an unknown encoding.","triggerScenarios":"Any 'short_payload' hash where decompression throws AND atob/JSON.parse of the Base64 fallback also throws — e.g. arbitrary garbage after the underscore, or payloads encoded by a newer format the installed CLI doesn't understand.","commonSituations":"Version mismatch between the dashboard that generated the hash and the CLI decoding it; hash corrupted in transit; hand-edited hashes.","solutions":["Update the CLI: `npx claude-code-templates@latest --workflow #hash` (newest decode formats)","Regenerate the share link from the current dashboard","Verify the payload wasn't altered (no URL decoding, no truncation, no regex-copied fragment)","As a last resort, manually rebuild the workflow instead of using the hash"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"null","typeGuard":null,"tryCatchPattern":"try {\n  await installWorkflowFromHash(hash);\n} catch (e) {\n  if (/Failed to decode workflow data/.test(e.message)) {\n    console.error('Unsupported/corrupt hash — update the CLI and regenerate the link');\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Always run npx claude-code-templates@latest when consuming share links","Regenerate links after dashboard upgrades","Never hand-edit hash payloads"],"tags":["workflow-hash","base64","encoding","version-mismatch","cli"],"backgroundTag":"corrupt-encoded-payload","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}