{"record":{"id":"3d33672788d6fbd5","repo":"PaddlePaddle/PaddleOCR","slug":"profileroptions-does-not-have-an-option-named-s","errorCode":null,"errorMessage":"ProfilerOptions does not have an option named %s.","messagePattern":"ProfilerOptions does not have an option named (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"ppocr/utils/profiler.py","lineNumber":83,"sourceCode":"            if key == \"batch_range\":\n                value_list = value.replace(\"[\", \"\").replace(\"]\", \"\").split(\",\")\n                value_list = list(map(int, value_list))\n                if (\n                    len(value_list) >= 2\n                    and value_list[0] >= 0\n                    and value_list[1] > value_list[0]\n                ):\n                    self._options[key] = value_list\n            elif key == \"exit_on_finished\":\n                self._options[key] = value.lower() in (\"yes\", \"true\", \"t\", \"1\")\n            elif key in [\"state\", \"sorted_key\", \"tracer_option\", \"profile_path\"]:\n                self._options[key] = value\n            elif key == \"timer_only\":\n                self._options[key] = value\n\n    def __getitem__(self, name):\n        if self._options.get(name, None) is None:\n            raise ValueError(\"ProfilerOptions does not have an option named %s.\" % name)\n        return self._options[name]\n\n\ndef add_profiler_step(options_str=None):\n    \"\"\"\n    Enable the operator-level timing using PaddlePaddle's profiler.\n    The profiler uses a independent variable to count the profiler steps.\n    One call of this function is treated as a profiler step.\n    Args:\n      profiler_options - a string to initialize the ProfilerOptions.\n                         Default is None, and the profiler is disabled.\n    \"\"\"\n    if options_str is None:\n        return\n\n    global _prof\n    global _profiler_step_id\n    global _profiler_options","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/ppocr/utils/profiler.py#L65-L101","documentation":"ValueError from ProfilerOptions.__getitem__ (ppocr/utils/profiler.py): looking up an option that was never set into self._options returns None and raises. Options are populated from the profiler options string (state, sorted_key, tracer_option, profile_path, exit_on_finished, timer_only, and the numeric list options), so any other name — or a valid name whose parsed value never landed in _options — triggers this.","triggerScenarios":"Passing a --profiler-options string with an unsupported key, or user code doing profiler_opts['missing_key']; also when a key like profile_path is expected to have a default but none was supplied in the options string.","commonSituations":"Enabling operator-level profiling (tools/infer/predict.py or train with profiler options) with key names copied from paddle's newer/older profiler API rather than this wrapper's accepted set; typos like 'sorted_keys'.","solutions":["Restrict keys in the profiler options string to the supported set: state, sorted_key, tracer_option, profile_path, exit_on_finished, timer_only (plus the documented numeric list options).","Use opts.get(name) style access or check 'name in opts._options' instead of opts[name] when a default is acceptable.","Run with no profiler options first to confirm profiling works, then add options one at a time."],"exampleFix":"# before\nopts = ProfilerOptions('state:OP')\npath = opts['profile_path']  # never set -> ValueError\n\n# after\npath = opts._options.get('profile_path', './profile_output')","handlingStrategy":"validation","validationCode":"KNOWN_OPTIONS = {\"state\", \"sorted_key\", \"tracer_option\", \"profile_path\", \"exit_on_finished\", \"timer_only\"}\nkeys = {kv.split(':')[0] for kv in options_str.split() if ':' in kv}\nunknown = keys - KNOWN_OPTIONS\nassert not unknown, f\"unsupported profiler options: {unknown}; supported: {sorted(KNOWN_OPTIONS)}\"","typeGuard":"def is_known_profiler_option(name) -> bool:\n    return name in {\"state\", \"sorted_key\", \"tracer_option\", \"profile_path\", \"exit_on_finished\", \"timer_only\"}","tryCatchPattern":null,"preventionTips":["Access ProfilerOptions via .get-style lookup (opts._options.get(name)) instead of opts[name] when defaults are acceptable.","Validate the profiler options string once at startup rather than per step."],"tags":["profiler","config","performance"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}