hyperledger/fabric · error
organization %s not found
Error message
organization %s not found
What it means
In `doPrintOrg` (cmd/configtxgen/main.go:147), after scanning all Organizations in the loaded profile, none matched the name given via `-printOrg`. configtxgen exhausts the org list without finding a case-sensitive match and returns `organization <name> not found`.
Source
Thrown at cmd/configtxgen/main.go:147
if err := protolator.DeepMarshalJSON(os.Stdout, &ordererext.DynamicOrdererOrgGroup{ConfigGroup: og}); err != nil {
return errors.Wrapf(err, "malformed org definition for org: %s", org.Name)
}
return nil
}
// Otherwise assume it is an Application OrgGroup, where the encoder is not strict whether anchor peers exist or not
ag, err := encoder.NewApplicationOrgGroup(org)
if err != nil {
return errors.Wrapf(err, "bad org definition for org %s", org.Name)
}
if err := protolator.DeepMarshalJSON(os.Stdout, &peerext.DynamicApplicationOrgGroup{ConfigGroup: ag}); err != nil {
return errors.Wrapf(err, "malformed org definition for org: %s", org.Name)
}
return nil
}
}
return errors.Errorf("organization %s not found", printOrg)
}
func writeFile(filename string, data []byte, perm os.FileMode) error {
dirPath := filepath.Dir(filename)
exists, err := dirExists(dirPath)
if err != nil {
return err
}
if !exists {
err = os.MkdirAll(dirPath, 0o750)
if err != nil {
return err
}
}
return os.WriteFile(filename, data, perm)
}
func dirExists(path string) (bool, error) {View on GitHub (pinned to 2736b63f8f)
Solutions
- Verify the exact Name field of the org in configtx.yaml and pass it verbatim to -printOrg (match is exact, not fuzzy).
- Ensure FABRIC_CFG_PATH points to the directory containing the intended configtx.yaml.
- Do not confuse the org's MSP ID (`ID:`) with its `Name:` — -printOrg matches Name.
- Run `configtxgen -printBlock` or inspect the profile to confirm the org is listed under Organizations.
Example fix
// before $ configtxgen -profile MyProfile -printOrg PeerOrgMSP // MSP ID, not Name -> not found // after $ configtxgen -profile MyProfile -printOrg PeerOrg // matches 'Name: PeerOrg' in configtx.yaml
Defensive patterns
Strategy: validation
Validate before calling
// Verify the org name exists before calling configtxgen
import yaml
cfg = yaml.safe_load(open('configtx.yaml'))
names = [o['Name'] for o in cfg['Organizations']]
if org_name not in names:
raise SystemExit(f"org '{org_name}' not found; available: {names}") Try / catch
out, err := exec.Command("configtxgen", "-profile", profile, "-printOrg", orgName).CombinedOutput()
if err != nil {
if strings.Contains(string(out), "not found") {
return fmt.Errorf("check -printOrg name matches the 'Name:' field; FABRIC_CFG_PATH=%s; output: %s", os.Getenv("FABRIC_CFG_PATH"), out)
}
} Prevention
- Copy the org Name exactly from configtx.yaml — matching is case-sensitive and exact.
- Set FABRIC_CFG_PATH explicitly to the directory holding your configtx.yaml.
- Remember -printOrg takes the org Name, not the MSP ID.
- Script org lookups from the parsed YAML instead of hardcoding names.
When it happens
Trigger: Running `configtxgen -printOrg SomeOrg` where SomeOrg does not exactly (case-sensitively) match any org's Name field under Organizations in the configtx.yaml profile, or when configtx.yaml/`FABRIC_CFG_PATH` points at a config that lacks the org entirely.
Common situations: Typo in the org name passed to -printOrg; wrong FABRIC_CFG_PATH so a different (default/empty) configtx.yaml is loaded; passing the org's MSP ID instead of its Name; org present in another profile section but not in Organizations.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- refusing to generate block which is missing orderer section
- malformed org definition for org: %s
- no such block number [%d] in index
- Value of File: was nil
- error loading TLS root certificate (%s)
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/f0f920f64701d5be.
Report an issue: GitHub.