{"record":{"id":"60c6bc8d5315556a","repo":"gastownhall/beads","slug":"peer-name-too-long-max-64-characters","errorCode":null,"errorMessage":"peer name too long (max 64 characters)","messagePattern":"peer name too long \\(max 64 characters\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dolt/credentials.go","lineNumber":45,"sourceCode":"// credentialKeyFile is the filename for the random encryption key stored alongside the database.\nconst credentialKeyFile = \".beads-credential-key\" //nolint:gosec // G101: not a credential, just a filename\n\nconst awsResponseChecksumValidationEnv = \"AWS_RESPONSE_CHECKSUM_VALIDATION\"\n\n// federationEnvMutex protects process-wide env vars from concurrent access.\n// Environment variables are process-global, so we need to serialize federation operations.\nvar federationEnvMutex sync.Mutex\n\n// validPeerNameRegex matches valid peer names (alphanumeric, hyphens, underscores)\nvar validPeerNameRegex = regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9_-]*$`)\n\n// validatePeerName checks that a peer name is safe for use as a Dolt remote name\nfunc validatePeerName(name string) error {\n\tif name == \"\" {\n\t\treturn fmt.Errorf(\"peer name cannot be empty\")\n\t}\n\tif len(name) > 64 {\n\t\treturn fmt.Errorf(\"peer name too long (max 64 characters)\")\n\t}\n\tif !validPeerNameRegex.MatchString(name) {\n\t\treturn fmt.Errorf(\"peer name must start with a letter and contain only alphanumeric characters, hyphens, and underscores\")\n\t}\n\treturn nil\n}\n\n// initCredentialKey loads or generates the credential encryption key.\n// The key file is stored in .beads/ (beadsDir), NOT in .beads/dolt/ (dbPath),\n// to avoid creating ghost directories in shared-server mode (GH bd-cby).\n// Falls back to the old dbPath location for transparent migration.\nfunc (s *DoltStore) initCredentialKey(ctx context.Context) error {\n\tif s.beadsDir == \"\" {\n\t\treturn nil // No filesystem path — credential encryption unavailable\n\t}\n\n\tkeyPath := filepath.Join(s.beadsDir, credentialKeyFile)\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/credentials.go#L27-L63","documentation":"validatePeerName caps peer names at 64 characters because the name is used as a Dolt remote name and must remain safe/short. Names longer than 64 characters are rejected with this error before any credential or remote setup happens.","triggerScenarios":"addFederationPeer receives a peer name whose len(name) > 64 — e.g. a full URL, a UUID with prefixes, or a generated identifier pasted directly as the peer name.","commonSituations":"Pasting a remote URL or long hostname as the peer name; programmatically generating names from long org/repo paths; concatenating environment prefixes that blow past 64 chars.","solutions":["Shorten the peer name to 64 characters or fewer, e.g. `bd peer add backup` instead of the full URL","Derive a short canonical name from the long identifier (org-repo abbreviation) in your scripts","Store the long endpoint in the peer's URL/config field and keep the name short"],"exampleFix":"// before\nbd peer add https://doltremoteapi.dolthub.com/gastownhall/beads   # too long\n// after\nbd peer add dolthub-beads --url https://doltremoteapi.dolthub.com/gastownhall/beads","handlingStrategy":"validation","validationCode":"func validPeerNameLength(name string) bool { return len(name) > 0 && len(name) <= 64 }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never use URLs, hostnames, or full remote endpoints as peer names","Truncate/abbreviate programmatically generated names to <=64 chars","Keep long endpoints in the peer's URL field, not its name","Add a length check in scripts before invoking peer add"],"tags":["validation","federation","peer-name","naming"],"backgroundTag":"invalid-peer-name","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}