{"record":{"id":"28982d48e89a2d8d","repo":"HMCL-dev/HMCL","slug":"launcher-config-path","errorCode":null,"errorMessage":"Launcher config path ","messagePattern":"Launcher config path ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCL/src/main/java/org/jackhuang/hmcl/setting/SettingsManager.java","lineNumber":1659,"sourceCode":"            }\n        } catch (IOException e) {\n            LOG.warning(\"Failed to get owner\");\n        }\n    }\n\n    /// Checks that the given config path is writable.\n    private static void checkWritable(Path location) throws IOException {\n        if (!Files.isWritable(location)) {\n            if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS\n                    && location.getFileSystem() == FileSystems.getDefault()\n                    && location.toFile().canWrite()) {\n                LOG.warning(\"Launcher config path \" + location + \" is not writable, but it seems to be a Samba share or OpenJDK bug\");\n                // There are some serious problems with the implementation of Samba or OpenJDK\n                throw new SambaException();\n            } else {\n                // the config cannot be saved\n                // throw up the error now to prevent further data loss\n                throw new IOException(\"Launcher config path \" + location + \" is not writable\");\n            }\n        }\n    }\n\n    /// Loads user settings and installs the save listener.\n    ///\n    /// @return the user settings file access status\n    private static SettingFileAccess loadUserSettings(\n            @Nullable LegacyConfigMigrator.UserSettingsMigrationResult migrationResult) throws IOException {\n        if (userSettingsInstance != null) {\n            throw new IllegalStateException(\"User settings are already loaded\");\n        }\n\n        boolean newlyCreated = !Files.exists(USER_SETTINGS_LOCATION);\n        @Nullable UserSettings migratedUserSettings = newlyCreated && migrationResult != null\n                ? migrationResult.userSettings()\n                : null;\n        JsonSettingFile.LoadResult<UserSettings> result = USER_SETTINGS_FILE.load(migratedUserSettings);","sourceCodeStart":1641,"sourceCodeEnd":1677,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCL/src/main/java/org/jackhuang/hmcl/setting/SettingsManager.java#L1641-L1677","documentation":"SettingsManager checks that the launcher config directory is writable before saving. When a writability check fails but the location looks like a Samba share (or the OpenJDK canWrite bug applies), it throws SambaException instead of silently failing, since proceeding could cause data loss.","triggerScenarios":"Placing the HMCL config path on a Samba/network share (or a filesystem where File.canWrite() misreports false) and then triggering a settings save.","commonSituations":"Config on a Windows SMB share or NAS mount; OpenJDK canWrite() false negatives on certain filesystems; read-only mounts.","solutions":["Move the HMCL data/config directory to a local writable path (e.g. launch with --hmcl-dir pointing elsewhere)","Ensure the Samba share is mounted read-write and the user has write permission","Remount or reconfigure the share so writability detection succeeds","Catch SambaException in the launcher UI and warn the user to relocate the config"],"exampleFix":"// before\nhmcl --workingdir /mnt/samba/hmcl\n// after\nhmcl --hmcl-dir ~/.local/share/hmcl","handlingStrategy":"try-catch","validationCode":"Path loc = Paths.get(location); if (!Files.isWritable(loc)) { LOG.warning(\"Config location not writable: \" + loc); }","typeGuard":null,"tryCatchPattern":"try { settingsManager.checkWritable(); } catch (SambaException e) { LOG.warning(\"Config on Samba share; writability may be misdetected\", e); } catch (IOException e) { /* relocate config */ }","preventionTips":["Store HMCL config locally; avoid network shares","Check share mount options (rw vs ro) before use","Test writability by creating a temp file in the config dir"],"tags":["filesystem","config","samba"],"backgroundTag":"file-write-permission-denied","analyzedSha":"24702dc5a0214034f4c27166d5fd30cad08cec19","analyzedAt":"2026-09-10T12:36:46.680Z","contentChangedAt":"2026-09-10T12:36:46.680Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}