{"record":{"id":"98ef821b3960660b","repo":"pulumi/pulumi","slug":"unknown-visibility-q","errorCode":null,"errorMessage":"unknown visibility: %q","messagePattern":"unknown visibility: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/go/common/apitype/package.go","lineNumber":210,"sourceCode":"\t\treturn \"<empty>\"\n\t}\n\treturn v.status\n}\n\nfunc (v Visibility) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(v.status)\n}\n\nfunc (v *Visibility) UnmarshalJSON(data []byte) error {\n\tvar status string\n\tif err := json.Unmarshal(data, &status); err != nil {\n\t\treturn err\n\t}\n\tswitch status {\n\tcase VisibilityPublic.status, VisibilityPrivate.status:\n\t\t*v = Visibility{status}\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown visibility: %q\", status)\n\t}\n\treturn nil\n}\n","sourceCodeStart":192,"sourceCodeEnd":214,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/go/common/apitype/package.go#L192-L214","documentation":"Package visibility is an enum restricted to \"public\" or \"private\". The Visibility UnmarshalText method validates any incoming visibility string against those two values and throws this error otherwise. It exists to keep visibility metadata canonical so downstream access-control logic can rely on the parsed value.","triggerScenarios":"Unmarshaling package metadata JSON where the visibility field holds a string other than \"public\" or \"private\" (typo, different casing, or an invented value like \"internal\").","commonSituations":"Hand-editing package.json-style metadata; migrating from another registry format that uses different visibility vocabulary; publishing tooling emitting a new visibility level the SDK doesn't know.","solutions":["Change the visibility value to exactly \"public\" or \"private\"","Trim whitespace and match lowercase spelling","Upgrade the SDK if the publisher legitimately introduced a new visibility level"],"exampleFix":"// before\n{\"visibility\": \"internal\"}\n\n// after\n{\"visibility\": \"private\"}","handlingStrategy":"validation","validationCode":"func validVisibility(s string) bool {\n    return s == \"public\" || s == \"private\"\n}","typeGuard":null,"tryCatchPattern":"var v apitype.Visibility\nif err := v.UnmarshalText([]byte(raw)); err != nil {\n    return fmt.Errorf(\"bad visibility %q: %w\", raw, err)\n}","preventionTips":["Use VisibilityPublic/VisibilityPrivate constants, never raw strings","Normalize external visibility values (lowercase, trim) before unmarshal","Check package metadata with a JSON schema in CI"],"tags":["go","api","validation","packages"],"backgroundTag":"invalid-enum-value","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}