{"record":{"id":"968bb6992c063f53","repo":"apache/cassandra","slug":"unknown-iomode","errorCode":null,"errorMessage":"Unknown IOMode ","messagePattern":"Unknown IOMode ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/io/util/ChannelProxy.java","lineNumber":78,"sourceCode":"        {\n            return FileChannel.open(file.toPath(), openOptions);\n        }\n        catch (IOException e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private static OpenOption[] openOptions(IOMode ioMode)\n    {\n        switch (ioMode)\n        {\n            case DIRECT:\n                return new OpenOption[]{ StandardOpenOption.READ, ExtendedOpenOption.DIRECT };\n            case BUFFERED:\n                return new OpenOption[]{ StandardOpenOption.READ };\n            default:\n                throw new IllegalArgumentException(\"Unknown IOMode \" + ioMode);\n        }\n    }\n\n    public ChannelProxy(String path)\n    {\n        this(new File(path));\n    }\n\n    public ChannelProxy(File file)\n    {\n        this(file, IOMode.BUFFERED);\n    }\n\n    public ChannelProxy(File file, IOMode ioMode)\n    {\n        this(file, openChannel(file, openOptions(ioMode)));\n    }\n","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/util/ChannelProxy.java#L60-L96","documentation":"Thrown by ChannelProxy.openOptions when a file read mode other than DIRECT or BUFFERED is passed. ioMode must be one of the known IOMode enum values that map to a set of OpenOptions used to open the read channel.","triggerScenarios":"Constructing a ChannelProxy (or Config-aware file open path) with an ioMode value not in the supported set — e.g. a null/unknown Config.disk_access_mode mapping, or programmatic misuse passing a raw string/enum variant the switch doesn't handle.","commonSituations":"Invalid disk_access_mode in cassandra.yaml producing an unexpected IOMode, custom code constructing ChannelProxy with an unhandled mode, config parsing regressions after upgrades.","solutions":["Set disk_access_mode to a valid value (auto, mmap, standard/direct) in cassandra.yaml","Check the ioMode value passed to the ChannelProxy constructor in custom code and use only IOMode.DIRECT or IOMode.BUFFERED","Upgrade/patch the mapping code so every IOMode enum variant has a case","Validate configuration values at startup before file access"],"exampleFix":"// before\nChannelProxy p = new ChannelProxy(file, ioMode /* null/unknown */);\n// after\nChannelProxy p = new ChannelProxy(file, ioMode == null ? IOMode.BUFFERED : ioMode);","handlingStrategy":"validation","validationCode":"// validate ioMode before constructing\nif (ioMode != IOMode.DIRECT && ioMode != IOMode.BUFFERED) throw new IllegalArgumentException(\"ioMode must be DIRECT or BUFFERED, got \" + ioMode);","typeGuard":"static boolean isSupported(IOMode m) { return m == IOMode.DIRECT || m == IOMode.BUFFERED; }","tryCatchPattern":"try { ch = new ChannelProxy(path, ioMode); } catch (IllegalArgumentException e) { ch = new ChannelProxy(path, IOMode.BUFFERED); }","preventionTips":["Keep disk_access_mode in cassandra.yaml within documented values","Map every enum variant when writing mode switches","Fail config parsing early on unknown modes"],"tags":["io","config","file-open","argument"],"backgroundTag":"invalid-enum-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}