{"record":{"id":"f3bc926449230b02","repo":"unclecode/crawl4ai","slug":"script-script-name-not-found-in-the-folder-curr","errorCode":null,"errorMessage":"Script {script_name} not found in the folder {current_script_path}","messagePattern":"Script (.+?) not found in the folder (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"crawl4ai/js_snippet/__init__.py","lineNumber":12,"sourceCode":"import os\n\n\n# Create a function get name of a js script, then load from the CURRENT folder of this script and return its content as string, make sure its error free\ndef load_js_script(script_name):\n    # Get the path of the current script\n    current_script_path = os.path.dirname(os.path.realpath(__file__))\n    # Get the path of the script to load\n    script_path = os.path.join(current_script_path, script_name + \".js\")\n    # Check if the script exists\n    if not os.path.exists(script_path):\n        raise ValueError(\n            f\"Script {script_name} not found in the folder {current_script_path}\"\n        )\n    # Load the content of the script\n    with open(script_path, \"r\") as f:\n        script_content = f.read()\n    return script_content\n","sourceCodeStart":1,"sourceCodeEnd":19,"githubUrl":"https://github.com/unclecode/crawl4ai/blob/7e801521428ee12509994d39151006f64055ebe3/crawl4ai/js_snippet/__init__.py#L1-L19","documentation":"Error \"Script {script_name} not found in the folder {current_script_path}\" thrown in unclecode/crawl4ai.","triggerScenarios":"Thrown at crawl4ai/js_snippet/__init__.py:12 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the script file name and that it exists in the js_snippet folder.","Pass an absolute path or place the .js file next to the installed package's js_snippet directory."],"exampleFix":"load_js_script(\"snippets/my_script.js\")  # path relative to the js_snippet folder","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7e801521428ee12509994d39151006f64055ebe3","analyzedAt":"2026-08-14T20:46:20.673Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}