{"record":{"id":"3c5ac7881d0cb0e1","repo":"davila7/claude-code-templates","slug":"invalid-hash-format-missing-encoded-data","errorCode":null,"errorMessage":"Invalid hash format: missing encoded data","messagePattern":"Invalid hash format: missing encoded data","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"cli-tool/src/index.js","lineNumber":2217,"sourceCode":"    throw new Error(`Decompression failed: ${error.message}`);\n  }\n}\n\n/**\n * Fetch workflow data from hash\n * In production, this would fetch from a remote workflow registry\n * For now, we'll simulate this functionality\n */\nasync function fetchWorkflowData(hash) {\n  try {\n    // Check if hash contains encoded data (new format: shortHash_encodedData)\n    if (hash.includes('_')) {\n      console.log(chalk.green('🔓 Decoding workflow from hash...'));\n      \n      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      ","sourceCodeStart":2199,"sourceCodeEnd":2235,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/index.js#L2199-L2235","documentation":"Thrown when a hash contains '_' but the part after the first underscore is empty — i.e. the short hash is present but the encoded workflow payload is missing. Hash format is '<shortHash>_<encodedData>'; 'abc_' or a hash ending in '_' triggers this.","triggerScenarios":"Input like 'x7k2_' or a hash where everything after '_' was truncated (line wrap, character limit, partial paste).","commonSituations":"Terminal line-wrapping when copying long hashes; messaging apps splitting the hash and the user copying only the first segment; manual truncation to fit a field.","solutions":["Copy the entire hash including everything after the underscore (it may be very long)","Paste with terminal line-wrap disabled or use a clipboard-based copy (share button) instead of text selection","If the hash genuinely has no payload, regenerate the share link"],"exampleFix":"// before\nrun('#a1b2_');   // throws: missing encoded data\n// after\nrun('#a1b2_<full-encoded-payload>');","handlingStrategy":"validation","validationCode":"const [short, payload] = hash.replace(/^#/, '').split('_');\nif (!payload) {\n  console.error('Hash truncated — everything after \"_\" is required');\n  process.exit(1);\n}","typeGuard":"function hasEncodedPayload(hash) {\n  const h = hash.replace(/^#/, '');\n  return h.includes('_') && h.split('_')[1]?.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Copy the entire hash; it can be hundreds of characters","Disable terminal line-wrap before selecting","Store hashes in files/clipboard managers rather than chat messages"],"tags":["workflow-hash","validation","input-format","cli"],"backgroundTag":"invalid-share-link-hash","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}