{"record":{"id":"9654139abce81ecf","repo":"floci-io/floci","slug":"unknown-storage-mode-mode","errorCode":null,"errorMessage":"Unknown storage mode: \" + mode","messagePattern":"Unknown storage mode: \" \\+ mode","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"src/main/java/io/github/hectorvent/floci/core/storage/StorageFactory.java","lineNumber":93,"sourceCode":"        LOG.debugv(\"Creating {0} storage for service {1} (file: {2})\", mode, serviceName, filePath);\n\n        StorageBackend<String, V> inner = switch (mode) {\n            case \"memory\" -> new InMemoryStorage<>();\n            case \"persistent\" -> new PersistentStorage<>(filePath, typeReference);\n            case \"hybrid\" -> {\n                var hybrid = new HybridStorage<>(filePath, typeReference, flushInterval);\n                hybridBackends.add(hybrid);\n                yield hybrid;\n            }\n            case \"wal\" -> {\n                Path snapshotPath = basePath.resolve(fileName.replace(\".json\", \"-snapshot.json\"));\n                Path walFilePath = basePath.resolve(fileName.replace(\".json\", \".wal\"));\n                long compactionInterval = config.storage().wal().compactionIntervalMs();\n                var wal = new WalStorage<>(snapshotPath, walFilePath, typeReference, compactionInterval);\n                walBackends.add(wal);\n                yield wal;\n            }\n            default -> throw new IllegalArgumentException(\"Unknown storage mode: \" + mode);\n        };\n\n        inner.load();\n\n        AccountAwareStorageBackend<V> backend = new AccountAwareStorageBackend<>(\n                inner, requestContextInstance, config.defaultAccountId());\n        allBackends.add(backend);\n        backendsByPath.put(filePath, backend);\n        return backend;\n    }\n\n    /** Load all storage backends from disk. */\n    public synchronized void loadAll() {\n        for (StorageBackend<?, ?> backend : allBackends) {\n            backend.load();\n        }\n    }\n","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/core/storage/StorageFactory.java#L75-L111","documentation":"Thrown by StorageFactory when creating a storage backend with a mode string that is not one of memory, persistent, hybrid, or wal (switch default branch). The mode comes from floci.storage configuration, globally or per-service, so this is a config typo caught lazily at first backend creation for that path.","triggerScenarios":"Setting floci.storage.mode (or a per-service storage mode, or FLOCI_STORAGE_MODE) to a misspelled value like 'persistant', 'Memory', 'file', 'local', or 'wla'. The error fires when the affected service first asks StorageFactory for a backend.","commonSituations":"Typos in YAML/env config; carrying config from another emulator's naming conventions (e.g. 'file' or 'disk'); case sensitivity; upgrading floci versions where mode names changed.","solutions":["Set the mode to one of: memory, persistent, hybrid, wal","Check both the global floci.storage.mode and any per-service overrides for typos and casing","Search config for the exact bad value shown in the message"],"exampleFix":"# before\nfloci.storage.mode: persistant\n\n# after\nfloci.storage.mode: persistent","handlingStrategy":"type-guard","validationCode":"static final Set<String> VALID_MODES = Set.of(\"memory\", \"persistent\", \"hybrid\", \"wal\");\nboolean validMode(String mode) { return VALID_MODES.contains(mode); }","typeGuard":"boolean isStorageMode(Object m) {\n    return m instanceof String s && Set.of(\"memory\", \"persistent\", \"hybrid\", \"wal\").contains(s);\n}","tryCatchPattern":"try {\n    storageFactory.create(path, typeRef);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown storage mode\")) { correctModeConfig(); } // config typo, fix and restart\n}","preventionTips":["Validate storage mode strings at config load time, not at first backend creation","Use enum-backed config binding where available so invalid values fail fast at parse time","Copy mode names exactly from docs: lower-case"],"tags":["storage","config","typo","startup"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}