{"record":{"id":"ba2ec25e4edb4e36","repo":"microsoft/FASTER","slug":"failed-to-open-file-for-hybrid-log","errorCode":null,"errorMessage":"Failed to open file for hybrid log","messagePattern":"Failed to open file for hybrid log","errorType":"exception","errorClass":"std::runtime_error","httpStatus":null,"severity":"critical","filePath":"cc/src/device/storage.h","lineNumber":1101,"sourceCode":"  ///    operating system.\n  /// \\param deleteOnClose\n  ///    If set to true, files created by the device will be deleted by the\n  ///    underlying operating system once closed.\n  StorageDevice(const std::string& root, LightEpoch& lEpoch,\n                const std::string& remote, uint16_t id=1,\n                bool unBuffered=false, bool deleteOnClose=false)\n    : localRoot{ FASTER::environment::NormalizePath(root) }\n    , epoch{ &lEpoch }\n    , unBuffered{ unBuffered }\n    , deleteOnClose{ deleteOnClose }\n    , ioHandler{ 8 }\n    , hLog{ localRoot, &ioHandler, &lEpoch, &pendingTasks, id, remote,\n            1024, 302, 30 }\n  {\n    if (hLog.Open() != Status::Ok) {\n      logMessage(Lvl::ERR,\n                 \"Failed to open hybrid log file on Storage device\");\n      throw std::runtime_error(\"Failed to open file for hybrid log\");\n    }\n  }\n\n  /// Constructor for unit testing.\n  ///\n  /// \\param lEpoch\n  ///    Pointer to the epoch manager.\n  StorageDevice(LightEpoch& lEpoch)\n    : localRoot{ \"C:\\\\faster\\\\\" }\n    , epoch{ &lEpoch }\n    , unBuffered{ false }\n    , deleteOnClose{ false }\n    , ioHandler{ 8 }\n    , hLog{ localRoot, &ioHandler, &lEpoch, &pendingTasks, 1,\n            \"UseDevelopmentStorage=true;\" }\n  {\n    if (hLog.Open() != Status::Ok) {\n      logMessage(Lvl::ERR,","sourceCodeStart":1083,"sourceCodeEnd":1119,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cc/src/device/storage.h#L1083-L1119","documentation":"The StorageDevice constructor opens its hybrid log via hLog.Open(); if the returned status is not Ok, it logs 'Failed to open hybrid log file on Storage device' and throws std::runtime_error('Failed to open file for hybrid log'). Construction of the device (and therefore FASTER init) fails.","triggerScenarios":"Constructing a StorageDevice whose hLog.Open() fails — missing local root directory, bad path/permissions, Azure storage emulator ('UseDevelopmentStorage') not running, or storage connection failures.","commonSituations":"Pointing FASTER at a nonexistent local path, insufficient write permissions, using the development-storage constructor without the Azure storage emulator started, wrong connection settings.","solutions":["Ensure the local root directory exists and is writable by the process","If using Azure storage, verify the emulator/account connectivity (e.g. start the storage emulator for UseDevelopmentStorage)","Catch the std::runtime_error around device construction and reinitialize with a corrected path","Check the preceding logMessage output for Open()'s failure reason"],"exampleFix":"// before\nFASTER::device::StorageDevice dev(\"C:/does/not/exist\", ...);\n// after (create dir first, then guard construction)\nstd::filesystem::create_directories(\"C:/faster-data\");\ntry {\n  FASTER::device::StorageDevice dev(\"C:/faster-data\", ...);\n} catch (const std::runtime_error& e) { /* handle */ }","handlingStrategy":"try-catch","validationCode":"if (!std::filesystem::exists(localRoot) ||\n    !std::filesystem::is_directory(localRoot))\n  throw std::runtime_error(\"hlog root missing: \" + localRoot);","typeGuard":null,"tryCatchPattern":"try {\n  FASTER::device::StorageDevice dev(root, ...);\n} catch (const std::runtime_error& e) {\n  if (std::string(e.what()).find(\"hybrid log\") != std::string::npos) {\n    // fix path/permissions or storage connectivity, then retry\n  }\n}","preventionTips":["Create and permission-check the local root directory before init","For Azure storage, verify emulator/account availability pre-startup","Check hLog.Open()'s logMessage output for the root cause"],"tags":["storage","azure","file-open","hybrid-log"],"backgroundTag":"file-open-failed","analyzedSha":"321d872eabda6a0345c8bd76419f89723ed864ae","analyzedAt":"2026-09-15T22:18:00.693Z","contentChangedAt":"2026-09-15T22:18:00.693Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}