{"record":{"id":"f71d82e8213ca32a","repo":"dgraph-io/badger","slug":"errplan9notsupported","errorCode":"ErrPlan9NotSupported","errorMessage":"Read-only mode is not supported on Plan 9","messagePattern":"Read-only mode is not supported on Plan 9","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"errors.go","lineNumber":85,"sourceCode":"\tErrManagedTxn = stderrors.New(\n\t\t\"Invalid API request. Not allowed to perform this action using ManagedDB\")\n\n\t// ErrNamespaceMode is returned if the user tries to use an API which is allowed only when\n\t// NamespaceOffset is non-negative.\n\tErrNamespaceMode = stderrors.New(\n\t\t\"Invalid API request. Not allowed to perform this action when NamespaceMode is not set.\")\n\n\t// ErrInvalidDump if a data dump made previously cannot be loaded into the database.\n\tErrInvalidDump = stderrors.New(\"Data dump cannot be read\")\n\n\t// ErrZeroBandwidth is returned if the user passes in zero bandwidth for sequence.\n\tErrZeroBandwidth = stderrors.New(\"Bandwidth must be greater than zero\")\n\n\t// ErrWindowsNotSupported is returned when opt.ReadOnly is used on Windows\n\tErrWindowsNotSupported = stderrors.New(\"Read-only mode is not supported on Windows\")\n\n\t// ErrPlan9NotSupported is returned when opt.ReadOnly is used on Plan 9\n\tErrPlan9NotSupported = stderrors.New(\"Read-only mode is not supported on Plan 9\")\n\n\t// ErrTruncateNeeded is returned when the value log gets corrupt, and requires truncation of\n\t// corrupt data to allow Badger to run properly.\n\tErrTruncateNeeded = stderrors.New(\n\t\t\"Log truncate required to run DB. This might result in data loss\")\n\n\t// ErrBlockedWrites is returned if the user called DropAll. During the process of dropping all\n\t// data from Badger, we stop accepting new writes, by returning this error.\n\tErrBlockedWrites = stderrors.New(\"Writes are blocked, possibly due to DropAll or Close\")\n\n\t// ErrNilCallback is returned when subscriber's callback is nil.\n\tErrNilCallback = stderrors.New(\"Callback cannot be nil\")\n\n\t// ErrEncryptionKeyMismatch is returned when the storage key is not\n\t// matched with the key previously given.\n\tErrEncryptionKeyMismatch = stderrors.New(\"Encryption key mismatch\")\n\n\t// ErrInvalidDataKeyID is returned if the datakey id is invalid.","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/dgraph-io/badger/blob/2a001d466f6b71a917319a1db41f99860e16e269/errors.go#L67-L103","documentation":"ErrPlan9NotSupported is returned when opt.ReadOnly is used on Plan 9, where read-only mode is not implemented. It surfaces from acquireDirectoryLock (dir_plan9.go:32) during DB.Open. Defined in errors.go.","triggerScenarios":"Opening a DB with badger.WithReadOnly(true) on a Plan 9 host; the check fires in acquireDirectoryLock during Open.","commonSituations":"Very rare; only Plan 9 deployments attempting read-only mode, typically ported configs from Linux where ReadOnly works.","solutions":["Remove the WithReadOnly option on Plan 9 and open read-write","Use a supported OS (Linux) for read-only replicas","Gate WithReadOnly behind a runtime.GOOS check"],"exampleFix":"// before\nopts = append(opts, badger.WithReadOnly(true))\ndb, err := badger.Open(opts...)\n// after\nif runtime.GOOS != \"plan9\" {\n\topts = append(opts, badger.WithReadOnly(true))\n}\ndb, err := badger.Open(opts...)","handlingStrategy":"validation","validationCode":"if readOnly && runtime.GOOS == \"plan9\" { return errors.New(\"ReadOnly unsupported on Plan 9\") }","typeGuard":null,"tryCatchPattern":"db, err := badger.Open(opts)\nif errors.Is(err, ErrPlan9NotSupported) {\n\t// drop ReadOnly option and reopen read-write\n}","preventionTips":["Gate WithReadOnly on runtime.GOOS","Avoid Plan 9 for production Badger workloads","Centralize platform-dependent Open options in one builder function"],"tags":["badger","plan9","read-only","platform-limitation"],"backgroundTag":"platform-not-supported","analyzedSha":"2a001d466f6b71a917319a1db41f99860e16e269","analyzedAt":"2026-09-05T13:00:02.264Z","contentChangedAt":"2026-09-05T13:00:02.264Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}