hyperledger/fabric · error
not a valid hashedDataNs [%s]
Error message
not a valid hashedDataNs [%s]
What it means
decodeHashedNs expects a hashed namespace string of the form <namespace><nsJoiner>hashDataPrefix<hash-part>, concatenated by the snapshot private-data hashing logic. Splitting on that joiner must yield exactly two parts; otherwise the string is not a valid hashed namespace and the error is thrown.
Source
Thrown at internal/ledgerutil/identifytxs/identifytxs.go:488
if e.BlockNum == v.searchBlockLimit && e.TxNum == v.searchTxLimit {
err = inputKeyMap.close(v)
if err != nil {
return false, err
}
delete(inputKeyMap, k)
// Check if all keys have reached their height limit
if len(inputKeyMap) == 0 {
return true, nil
}
}
return false, nil
}
// Exctracts namespace from snapshot namespace concatenation
func decodeHashedNs(hashedDataNs string) (string, string, error) {
strs := strings.Split(hashedDataNs, nsJoiner+hashDataPrefix)
if len(strs) != 2 {
return "", "", errors.Errorf("not a valid hashedDataNs [%s]", hashedDataNs)
}
return strs[0], strs[1], nil
}
View on GitHub (pinned to 2736b63f8f)
Solutions
- Confirm the input files were produced by the same Fabric version and tooling as verify/identifytxs
- Do not modify the records JSON manually; regenerate it from the original snapshot
- Ensure the namespace in question is actually a private/collection namespace and not a public one
- Inspect the failing hashedDataNs value in the input file for missing separators or corruption
Defensive patterns
Strategy: validation
Validate before calling
func looksLikeHashedNs(ns string, joiner, prefix string) bool {
parts := strings.Split(ns, joiner+prefix)
return len(parts) == 2 && parts[1] != ""
} Type guard
func isHashedDataNs(s string) bool {
return strings.Count(s, nsJoiner+hashDataPrefix) == 1
} Try / catch
ns, hashPart, err := decodeHashedNs(key)
if err != nil {
log.Warnf("skipping non-hashed namespace key %q", key)
continue
} Prevention
- Only feed records files generated by the matching Fabric version
- Never hand-edit snapshot/records JSON keys
- Check that the key actually belongs to a private data collection namespace before decoding
When it happens
Trigger: generateRecordsMap encountering a records-map key (hashedDataNs) that does not contain the expected separator+hash prefix — e.g. a plain (non-hashed) namespace, a differently formatted key, or corrupted/truncated input file data.
Common situations: Feeding the tool a records/verify output produced by a different Fabric version with different namespace concatenation, hand-edited JSON, or a mismatched collection config that changed how hashed namespaces were written.
Related errors
- dir %s not empty
- expected two space separated tokens, but got %d
- unknown rule type '%s', expected ALL, ANY, or MAJORITY
- not a chaincode type: %s
- LSCC invocation is attempting to write to namespace %s
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/762072651667442b.
Report an issue: GitHub.