{"record":{"id":"783ebc2d5103eba2","repo":"davila7/claude-code-templates","slug":"invalid-workflow-data-structure-in-hash","errorCode":null,"errorMessage":"Invalid workflow data structure in hash","messagePattern":"Invalid workflow data structure in hash","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli-tool/src/index.js","lineNumber":2238,"sourceCode":"      // 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 || [],\n        version: decodedData.version,\n        hash: shortHash,\n        steps: decodedData.steps,\n        components: decodedData.components,\n        yaml: decodedData.yaml,\n        timestamp: decodedData.timestamp","sourceCodeStart":2220,"sourceCodeEnd":2256,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/index.js#L2220-L2256","documentation":"Structural validation after successful decode: the decoded object must contain metadata, steps, and components. If any is missing, the payload decoded fine but isn't a valid workflow, so the CLI refuses to install it.","triggerScenarios":"A decodable JSON payload after the '_' that lacks one of the required keys — e.g. a hash encoding {name, steps} without metadata/components, or a payload built by a different tool/version with a different schema.","commonSituations":"Version skew: older hashes without the `components` field, or newer schema changes; users hand-crafting hashes from arbitrary JSON.","solutions":["Upgrade the CLI to a version matching the dashboard that produced the hash (or vice versa)","Regenerate the share link so the payload includes metadata, steps, and components","If building hashes programmatically, include all three required fields in the encoded JSON"],"exampleFix":"// before (payload)\n{\"name\":\"my-flow\",\"steps\":[...]}\n// after (payload)\n{\"metadata\":{...},\"steps\":[...],\"components\":[...]}","handlingStrategy":"type-guard","validationCode":"null","typeGuard":"function isWorkflowData(d) {\n  return d != null && typeof d === 'object'\n    && 'metadata' in d && 'steps' in d && Array.isArray(d.steps)\n    && 'components' in d;\n}\n// if generating hashes programmatically, validate before encoding:\nif (!isWorkflowData(data)) throw new Error('workflow missing metadata/steps/components');","tryCatchPattern":"try {\n  await installWorkflowFromHash(hash);\n} catch (e) {\n  if (/Invalid workflow data structure/.test(e.message)) {\n    console.error('Hash decodes to an incompatible schema — regenerate with matching versions');\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Keep CLI and dashboard on matching versions","When encoding workflows into hashes, always include metadata, steps, and components","Re-share workflows after any schema change instead of reusing old hashes"],"tags":["workflow-hash","schema-validation","encoding","cli"],"backgroundTag":"schema-validation-failed","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}