davila7/claude-code-templates · warning · Error
Invalid hash format: missing encoded data
Error message
Invalid hash format: missing encoded data
What it means
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.
Source
Thrown at cli-tool/src/index.js:2217
throw new Error(`Decompression failed: ${error.message}`);
}
}
/**
* Fetch workflow data from hash
* In production, this would fetch from a remote workflow registry
* For now, we'll simulate this functionality
*/
async function fetchWorkflowData(hash) {
try {
// Check if hash contains encoded data (new format: shortHash_encodedData)
if (hash.includes('_')) {
console.log(chalk.green('🔓 Decoding workflow from hash...'));
const [shortHash, encodedData] = hash.split('_', 2);
if (!encodedData) {
throw new Error('Invalid hash format: missing encoded data');
}
// Decode compressed data
let decodedData;
try {
// First try to decompress the data (new compressed format)
const decompressedString = decompressString(encodedData);
decodedData = JSON.parse(decompressedString);
} catch (decompressError) {
// Fallback to old Base64 format for compatibility
try {
const decodedString = decodeURIComponent(escape(atob(encodedData)));
decodedData = JSON.parse(decodedString);
} catch (base64Error) {
throw new Error('Failed to decode workflow data from hash');
}
}
View on GitHub (pinned to a0851ed10c)
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
Example fix
// before
run('#a1b2_'); // throws: missing encoded data
// after
run('#a1b2_<full-encoded-payload>'); Defensive patterns
Strategy: validation
Validate before calling
const [short, payload] = hash.replace(/^#/, '').split('_');
if (!payload) {
console.error('Hash truncated — everything after "_" is required');
process.exit(1);
} Type guard
function hasEncodedPayload(hash) {
const h = hash.replace(/^#/, '');
return h.includes('_') && h.split('_')[1]?.length > 0;
} Prevention
- 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
When it happens
Trigger: Input like 'x7k2_' or a hash where everything after '_' was truncated (line wrap, character limit, partial paste).
Common situations: 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.
Related errors
- Invalid workflow hash format. Expected format: #hash
- Workflow with hash "${hash}" not found. Please check the has
- Decompression failed: ${error.message}
- Failed to decode workflow data from hash
- Invalid workflow data structure in hash
AI-assisted analysis of davila7/claude-code-templates@a0851ed10c (2026-08-28).
Data as JSON: /api/errors/3c5ac7881d0cb0e1.
Report an issue: GitHub.