{"record":{"id":"88ef76cc2ca06583","repo":"pulumi/pulumi","slug":"project-names-are-limited-to-100-characters","errorCode":null,"errorMessage":"project names are limited to 100 characters","messagePattern":"project names are limited to 100 characters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/go/common/tokens/project.go","lineNumber":33,"sourceCode":"package tokens\n\nimport \"errors\"\n\n// ValidateProjectName validates that the given string is a valid project name.\n// The string must meet the following criteria:\n//\n//   - must be non-empty\n//   - must be at most 100 characters\n//   - must contain only alphanumeric characters,\n//     hyphens, underscores, and periods (see [IsName])\n//\n// Returns a descriptive error if the string is not a valid project name.\nfunc ValidateProjectName(s string) error {\n\tswitch {\n\tcase s == \"\":\n\t\treturn errors.New(\"project names may not be empty\")\n\tcase len(s) > 100:\n\t\treturn errors.New(\"project names are limited to 100 characters\")\n\tcase !IsName(s):\n\t\treturn errors.New(\"project names may only contain alphanumerics, hyphens, underscores, and periods\")\n\t}\n\treturn nil\n}\n","sourceCodeStart":15,"sourceCodeEnd":39,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/go/common/tokens/project.go#L15-L39","documentation":"Project names are capped at 100 characters by ValidateProjectName. Longer strings are rejected to keep URNs, resource names, and backend identifiers within safe limits.","triggerScenarios":"Calling tokens.ValidateProjectName with a string longer than 100 bytes — typically derived by prefixing directories, org names, or CI-generated names.","commonSituations":"Deeply nested monorepo directories auto-derived as project names; org-name + repo-name concatenation in CI pipelines; programmatic project creation joining multiple identifiers.","solutions":["Shorten the project name to <=100 characters","Stop concatenating long prefixes into the project name","Derive the name from a stable short identifier (repo slug) instead of the full path"],"exampleFix":"// before\nname := \"acme-corp-platform-\" + strings.ReplaceAll(fullDirPath, \"/\", \"-\")\n// after\nname := \"acme-\" + filepath.Base(fullDirPath)","handlingStrategy":"validation","validationCode":"if len(projectName) > 100 {\n    return fmt.Errorf(\"project name %q is %d chars; max is 100\", projectName, len(projectName))\n}\nreturn tokens.ValidateProjectName(projectName)","typeGuard":"func projectNameFits(s string) bool { return len(s) <= 100 }","tryCatchPattern":"if err := tokens.ValidateProjectName(long); err != nil {\n    if strings.Contains(err.Error(), \"100 characters\") {\n        long = long[:100]\n        err = tokens.ValidateProjectName(long)\n    }\n    if err != nil { return err }\n}","preventionTips":["Don't concatenate long org/repo prefixes into project names","Enforce the limit in config templates and scaffolding tools","Derive names from short repo slugs, not absolute paths","Check byte length (len), not rune count, since the check uses len(s)"],"tags":["go","project-name","validation"],"backgroundTag":"project-name-too-long","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}