{"record":{"id":"9f2f1ec28d8d354b","repo":"deepinsight/insightface","slug":"out-of-range-in-parameter-get","errorCode":null,"errorMessage":"out_of_range in Parameter::get : ","messagePattern":"out_of_range in Parameter::get : ","errorType":"exception","errorClass":"std::out_of_range","httpStatus":null,"severity":"error","filePath":"cpp-package/inspireface/cpp/inspireface/middleware/configurable.h","lineNumber":77,"sourceCode":"    /**\n     * @brief Set a parameter with a specific name and value.\n     * @param name The name of the parameter.\n     * @param value The value to set for the parameter.\n     */\n    template <typename ValueType>\n    void set(const std::string& name, const ValueType& value) {\n        m_configuration[name] = value;\n    }\n\n    /**\n     * @brief Set a parameter with a specific name and value.\n     * @param name The name of the parameter.\n     * @param value The value to set for the parameter.\n     */\n    template <typename ValueType>\n    ValueType get(const std::string& name) const {\n        if (!has(name)) {\n            throw std::out_of_range(\"out_of_range in Parameter::get : \" + name);\n        }\n        return m_configuration.at(name).get<ValueType>();\n    }\n\n    /**\n     * @brief Load parameters from a JSON object.\n     * @param j The JSON object containing parameters.\n     */\n    void load(const nlohmann::json& j) {\n        for (const auto& item : j.items()) {\n            const auto& key = item.key();\n            const auto& value = item.value();\n\n            if (value.is_boolean()) {\n                set<bool>(key, value.get<bool>());\n            } else if (value.is_number_integer()) {\n                set<int>(key, value.get<int>());\n            } else if (value.is_number_float()) {","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/deepinsight/insightface/blob/7fadd420c2351d0ffa8cac403421c1a3ed733365/cpp-package/inspireface/cpp/inspireface/middleware/configurable.h#L59-L95","documentation":"Parameter::get<ValueType>(name) looks up a key in the configuration map and throws std::out_of_range including the key name when has(name) is false. This is the library's standard way of saying a required configuration/manifest key is missing — the message suffix tells you exactly which key was requested. It propagates up through callers such as next, get_image_feature, and extract_feats_labels, which read pipeline configuration keys at runtime.","triggerScenarios":"Loading a session/resource pack whose JSON configuration is missing a key that the running code path expects (e.g. feature extraction parameters when calling get_image_feature/extract_feats_labels); passing a custom or hand-edited resource pack with renamed/omitted fields; version mismatch where a newer binary expects config keys absent from an older .bundle/pack file; a typo in the key name passed to get().","commonSituations":"Upgrading the InspireFace native library without regenerating/upgrading the resource pack so new config keys don't exist; using a stripped-down model pack for a feature (e.g. face feature extraction) whose section isn't in the JSON; swapping contexts between detection-only and full pipelines while the loaded configuration only contains the detection section.","solutions":["Note the key name in the exception message and inspect the loaded pack's JSON configuration to confirm whether that key exists.","Ensure the resource pack / model bundle version matches the InspireFace library version — regenerate or download the matching pack.","If building the config yourself, add the missing key with a valid value per the schema used by the calling code path.","Guard reads with has(name) or get-or-default accessors for optional parameters instead of blind get()."],"exampleFix":"// before\nint threads = param.get<int>(\"feature_extract_threads\"); // throws out_of_range if key missing\n// after\nint threads = param.has(\"feature_extract_threads\")\n    ? param.get<int>(\"feature_extract_threads\")\n    : 4; // sensible default","handlingStrategy":"try-catch","validationCode":"// Parameter exposes has(name) — check before get\nif (param.has(\"feature_extract_threads\")) {\n    threads = param.get<int>(\"feature_extract_threads\");\n} else {\n    threads = 4; // default\n}","typeGuard":null,"tryCatchPattern":"try {\n    auto v = param.get<int>(key);\n} catch (const std::out_of_range& e) {\n    // e.what() contains the missing key name; log and apply default\n}","preventionTips":["Pin resource-pack version to the library version; regenerate packs on upgrade.","Validate required keys right after loading the config and fail fast with a clear message.","Prefer has()/default-value reads for optional parameters."],"tags":["configuration","missing-key","out-of-range","json-config","resource-pack"],"backgroundTag":"missing-config-key","analyzedSha":"7fadd420c2351d0ffa8cac403421c1a3ed733365","analyzedAt":"2026-08-28T15:44:01.850Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}