[GH-ISSUE #7339] Error: an unknown error was encountered while running the model #30422

Closed
opened 2026-04-22 10:02:10 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @ipsmile on GitHub (Oct 24, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7339

What is the issue?

$ ollama run deepseek-coder-v2
pulling manifest
pulling 5ff0abeeac1d... 100% ▕████████████████▏ 8.9 GB
pulling 22091531faf0... 100% ▕████████████████▏ 705 B
pulling 4bb71764481f... 100% ▕████████████████▏ 13 KB
pulling 1c8f573e830c... 100% ▕████████████████▏ 1.1 KB
pulling 19f2fb9e8bc6... 100% ▕████████████████▏ 32 B
pulling 34488e453cfe... 100% ▕████████████████▏ 568 B
verifying sha256 digest
writing manifest
success

provide a line by line analysis for the following code: require("inc/inc.Set
... tings.php");
...
... if(true) {
... require_once("inc/inc.Utils.php");
... require_once("inc/inc.LogInit.php");
... require_once("inc/inc.Language.php");
... require_once("inc/inc.Init.php");
... require_once("inc/inc.Extension.php");
... require_once("inc/inc.DBInit.php");
...
... $c = new \Slim\Container(); //Create Your container
... $c['notFoundHandler'] = function ($c) use ($settings, $dms) {
... return function ($request, $response) use ($c, $settings, $d
... ms) {
... $uri = $request->getUri();
... if($uri->getBasePath())
... $file = $uri->getPath();
... else
... $file = substr($uri->getPath(), 1);
... if(file_exists($file) && is_file($file)) {
... $_SERVER['SCRIPT_FILENAME'] = basename($file
... );
... // include($file);
... exit;
... }
... if($request->isXhr()) {
... exit;
... }
... // print_r($request->getUri());
... // exit;
... return $c['response']
... ->withStatus(302)
... ->withHeader('Location', isset($settings->_s
... iteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_httpR
... oot.$settings->_siteDefaultPage : $settings->_httpRoot."out/out.ViewFolder.p
... hp");
... };
... };
... $app = new \Slim\App($c);
... $container = $app->getContainer();
... $container['dms'] = $dms;
... $container['config'] = $settings;
... $container['conversionmgr'] = $conversionmgr;
... $container['logger'] = $logger;
... $container['fulltextservice'] = $fulltextservice;
... $container['notifier'] = $notifier;
... $container['authenticator'] = $authenticator;
...
... if(isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) {
... foreach($GLOBALS['SEEDDMS_HOOKS']['initDMS'] as $hookObj) {
... if (method_exists($hookObj, 'addRoute')) {
... $hookObj->addRoute(array('dms'=>$dms, 'app'=
... >$app, 'settings'=>$settings, 'conversionmgr'=>$conversionmgr, 'authenticato
... r'=>$authenticator, 'fulltextservice'=>$fulltextservice, 'logger'=>$logger))
... ;
... // } else {
... // include("inc/inc.Authentication.php");
... // if (method_exists($hookObj, 'addRouteAfter
... Authentication')) {
... // $hookObj->addRouteAfterAuthenticat
... ion(array('dms'=>$dms, 'app'=>$app, 'settings'=>$settings, 'user'=>$user));
... // }
... }
... }
... }
...
... /*
... $app->get('/out/[{path:.*}]', function($request, $response, $path =
... null) use ($app) {
... $uri = $request->getUri();
... if($uri->getBasePath())
... $file = $uri->getPath();
... else
... $file = substr($uri->getPath(), 1);
... if(file_exists($file) && is_file($file)) {
... $_SERVER['SCRIPT_FILENAME'] = basename($file);
... include($file);
... exit;
... }
... });
... */
...
... $app->run();
... } else {
...
... header("Location: ". (isset(settings->_siteDefaultPage) && strlen(
... settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewF
... older.php"));
...
Here's a line-by-line analysis of the provided PHP code snippet:

require("inc/inc.Settings.php"); // This line includes the Settings file 
which is necessary for the script to function correctly, as it likely 
contains configuration settings or global variables used throughout the 
application.

if(true) { // The if statement always evaluates to true due to its 
condition being a constant boolean value 'true'. Therefore, the code 
inside this block will execute every time the script is run.
    require_once("inc/inc.Utils.php"); // This line includes the Utils 
file which might contain utility functions that can be used throughout the 
application. The `require_once` ensures the file is only included once 
even if it's called multiple times in the script.
    require_once("inc/inc.LogInit.php"); // Similar to above, this line 
includes a log initialization file which might set up logging mechanisms 
for error tracking or other informational outputs.
    require_once("inc/inc.Language.php"); // This includes a language 
configuration file which could be used for internationalization and 
localization purposes in the application.
    require_once("inc/inc.Init.php"); // Another initialization file, 
possibly setting up initial configurations or environment settings needed 
by various parts of the script.
    require_once("inc/inc.Extension.php"); // This line includes a file 
that might contain extensions or additional functionalities provided as 
modules to enhance the application's capabilities.
    require_once("inc/inc.DBInit.php"); // This includes database 
initialization code, possibly setting up database connections and 
configurations used throughout the application.

    $c = new \Slim\Container(); // Creates a new container instance using 
the Slim framework's Container class. A container is typically used for 
dependency injection in frameworks like Slim.
    $c['notFoundHandler'] = function ($c) use ($settings, $dms) { // 
Defines an anonymous function as the not found handler for requests made 
to routes that do not exist or are not mapped properly. It uses a closure 
to capture the settings and dms variables from the parent scope.
        return function ($request, $response) use ($c, $settings, $dms) { 
// The anonymous function returns another anonymous function which is 
triggered when a 404 error occurs. This inner function captures request, 
response, container, settings, and dms as well.
            $uri = $request->getUri(); // Retrieves the URI object from 
the Slim request to get details about the current request URL.
            if($uri->getBasePath()) // Checks if there is a base path set 
in the URI, possibly for routing purposes.
                $file = $uri->getPath(); // If a base path exists, it uses 
the entire path; otherwise, it takes the path starting from index 1 to 
avoid leading slash issues.
            else
                $file = substr($uri->getPath(), 1); // Retrieves the path 
and skips the first character (usually a slash) if no base path is set.
            if(file_exists($file) && is_file($file)) { // Checks if the 
file exists in the specified path and whether it's a regular file (not 
directory).
                $_SERVER['SCRIPT_FILENAME'] = basename($file); // If the 
file exists, sets the SCRIPT_FILENAME server variable to the name of the 
file.
//                                include($file); // This line would 
normally be used to include and execute the PHP code contained in the 
found file but has been commented out here.
                exit; // Terminates the script execution after including 
or processing the file.
            }
            if($request->isXhr()) { // Checks if the request is an AJAX 
(XMLHttpRequest) type.
                exit; // If it's an AJAX request, terminates the script 
execution immediately.
            }
//                        print_r($request->getUri()); // This line would 
normally be used to debug by printing the URI object for debugging 
purposes but has been commented out here.
//                        exit; // Terminates the script after possibly 
outputting debug information.
            return $c['response'] // If none of the above conditions are 
met, returns a redirect response to the default page or an error handling 
page based on configuration settings.
                ->withStatus(302) // Sets the HTTP status code to 302 
(Found), which means temporarily moved to another URL.
                ->withHeader('Location', 
isset($settings->_siteDefaultPage) && 
strlen($settings->_siteDefaultPage)>0 ? 
$settings->_httpRoot.$settings->_siteDefaultPage : 
$settings->_httpRoot."out/out.ViewFolder.php"); // Sets the header for 
redirection, using the configured default page or a fallback if not set.
            };
        };
    $app = new \Slim\App($c); // Creates a new Slim application instance 
with the previously created container as its dependency injection 
container.
    $container = $app->getContainer(); // Retrieves and assigns to 
`$container` the current application's service container, which includes 
various components like settings, database connections, etc.
    $container['dms'] = $dms; // Assigns the dms object (presumably a 
dependency) to the 'dms' key in the Slim container for easy access 
throughout the app.
Error: an unknown error was encountered while running the model 


### OS

Linux

### GPU

AMD

### CPU

AMD

### Ollama version

 0.3.13
Originally created by @ipsmile on GitHub (Oct 24, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7339 ### What is the issue? $ ollama run deepseek-coder-v2 pulling manifest pulling 5ff0abeeac1d... 100% ▕████████████████▏ 8.9 GB pulling 22091531faf0... 100% ▕████████████████▏ 705 B pulling 4bb71764481f... 100% ▕████████████████▏ 13 KB pulling 1c8f573e830c... 100% ▕████████████████▏ 1.1 KB pulling 19f2fb9e8bc6... 100% ▕████████████████▏ 32 B pulling 34488e453cfe... 100% ▕████████████████▏ 568 B verifying sha256 digest writing manifest success >>> provide a line by line analysis for the following code: require("inc/inc.Set ... tings.php"); ... ... if(true) { ... require_once("inc/inc.Utils.php"); ... require_once("inc/inc.LogInit.php"); ... require_once("inc/inc.Language.php"); ... require_once("inc/inc.Init.php"); ... require_once("inc/inc.Extension.php"); ... require_once("inc/inc.DBInit.php"); ... ... $c = new \Slim\Container(); //Create Your container ... $c['notFoundHandler'] = function ($c) use ($settings, $dms) { ... return function ($request, $response) use ($c, $settings, $d ... ms) { ... $uri = $request->getUri(); ... if($uri->getBasePath()) ... $file = $uri->getPath(); ... else ... $file = substr($uri->getPath(), 1); ... if(file_exists($file) && is_file($file)) { ... $_SERVER['SCRIPT_FILENAME'] = basename($file ... ); ... // include($file); ... exit; ... } ... if($request->isXhr()) { ... exit; ... } ... // print_r($request->getUri()); ... // exit; ... return $c['response'] ... ->withStatus(302) ... ->withHeader('Location', isset($settings->_s ... iteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_httpR ... oot.$settings->_siteDefaultPage : $settings->_httpRoot."out/out.ViewFolder.p ... hp"); ... }; ... }; ... $app = new \Slim\App($c); ... $container = $app->getContainer(); ... $container['dms'] = $dms; ... $container['config'] = $settings; ... $container['conversionmgr'] = $conversionmgr; ... $container['logger'] = $logger; ... $container['fulltextservice'] = $fulltextservice; ... $container['notifier'] = $notifier; ... $container['authenticator'] = $authenticator; ... ... if(isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) { ... foreach($GLOBALS['SEEDDMS_HOOKS']['initDMS'] as $hookObj) { ... if (method_exists($hookObj, 'addRoute')) { ... $hookObj->addRoute(array('dms'=>$dms, 'app'= ... >$app, 'settings'=>$settings, 'conversionmgr'=>$conversionmgr, 'authenticato ... r'=>$authenticator, 'fulltextservice'=>$fulltextservice, 'logger'=>$logger)) ... ; ... // } else { ... // include("inc/inc.Authentication.php"); ... // if (method_exists($hookObj, 'addRouteAfter ... Authentication')) { ... // $hookObj->addRouteAfterAuthenticat ... ion(array('dms'=>$dms, 'app'=>$app, 'settings'=>$settings, 'user'=>$user)); ... // } ... } ... } ... } ... ... /* ... $app->get('/out/[{path:.*}]', function($request, $response, $path = ... null) use ($app) { ... $uri = $request->getUri(); ... if($uri->getBasePath()) ... $file = $uri->getPath(); ... else ... $file = substr($uri->getPath(), 1); ... if(file_exists($file) && is_file($file)) { ... $_SERVER['SCRIPT_FILENAME'] = basename($file); ... include($file); ... exit; ... } ... }); ... */ ... ... $app->run(); ... } else { ... ... header("Location: ". (isset($settings->_siteDefaultPage) && strlen($ ... settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewF ... older.php")); ... Here's a line-by-line analysis of the provided PHP code snippet: ```php require("inc/inc.Settings.php"); // This line includes the Settings file which is necessary for the script to function correctly, as it likely contains configuration settings or global variables used throughout the application. if(true) { // The if statement always evaluates to true due to its condition being a constant boolean value 'true'. Therefore, the code inside this block will execute every time the script is run. require_once("inc/inc.Utils.php"); // This line includes the Utils file which might contain utility functions that can be used throughout the application. The `require_once` ensures the file is only included once even if it's called multiple times in the script. require_once("inc/inc.LogInit.php"); // Similar to above, this line includes a log initialization file which might set up logging mechanisms for error tracking or other informational outputs. require_once("inc/inc.Language.php"); // This includes a language configuration file which could be used for internationalization and localization purposes in the application. require_once("inc/inc.Init.php"); // Another initialization file, possibly setting up initial configurations or environment settings needed by various parts of the script. require_once("inc/inc.Extension.php"); // This line includes a file that might contain extensions or additional functionalities provided as modules to enhance the application's capabilities. require_once("inc/inc.DBInit.php"); // This includes database initialization code, possibly setting up database connections and configurations used throughout the application. $c = new \Slim\Container(); // Creates a new container instance using the Slim framework's Container class. A container is typically used for dependency injection in frameworks like Slim. $c['notFoundHandler'] = function ($c) use ($settings, $dms) { // Defines an anonymous function as the not found handler for requests made to routes that do not exist or are not mapped properly. It uses a closure to capture the settings and dms variables from the parent scope. return function ($request, $response) use ($c, $settings, $dms) { // The anonymous function returns another anonymous function which is triggered when a 404 error occurs. This inner function captures request, response, container, settings, and dms as well. $uri = $request->getUri(); // Retrieves the URI object from the Slim request to get details about the current request URL. if($uri->getBasePath()) // Checks if there is a base path set in the URI, possibly for routing purposes. $file = $uri->getPath(); // If a base path exists, it uses the entire path; otherwise, it takes the path starting from index 1 to avoid leading slash issues. else $file = substr($uri->getPath(), 1); // Retrieves the path and skips the first character (usually a slash) if no base path is set. if(file_exists($file) && is_file($file)) { // Checks if the file exists in the specified path and whether it's a regular file (not directory). $_SERVER['SCRIPT_FILENAME'] = basename($file); // If the file exists, sets the SCRIPT_FILENAME server variable to the name of the file. // include($file); // This line would normally be used to include and execute the PHP code contained in the found file but has been commented out here. exit; // Terminates the script execution after including or processing the file. } if($request->isXhr()) { // Checks if the request is an AJAX (XMLHttpRequest) type. exit; // If it's an AJAX request, terminates the script execution immediately. } // print_r($request->getUri()); // This line would normally be used to debug by printing the URI object for debugging purposes but has been commented out here. // exit; // Terminates the script after possibly outputting debug information. return $c['response'] // If none of the above conditions are met, returns a redirect response to the default page or an error handling page based on configuration settings. ->withStatus(302) // Sets the HTTP status code to 302 (Found), which means temporarily moved to another URL. ->withHeader('Location', isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_httpRoot.$settings->_siteDefaultPage : $settings->_httpRoot."out/out.ViewFolder.php"); // Sets the header for redirection, using the configured default page or a fallback if not set. }; }; $app = new \Slim\App($c); // Creates a new Slim application instance with the previously created container as its dependency injection container. $container = $app->getContainer(); // Retrieves and assigns to `$container` the current application's service container, which includes various components like settings, database connections, etc. $container['dms'] = $dms; // Assigns the dms object (presumably a dependency) to the 'dms' key in the Slim container for easy access throughout the app. Error: an unknown error was encountered while running the model ### OS Linux ### GPU AMD ### CPU AMD ### Ollama version 0.3.13
GiteaMirror added the needs more infobug labels 2026-04-22 10:02:10 -05:00
Author
Owner

@rick-github commented on GitHub (Oct 24, 2024):

System logs will help in debugging.

<!-- gh-comment-id:2434827983 --> @rick-github commented on GitHub (Oct 24, 2024): [System logs](https://github.com/ollama/ollama/blob/main/docs/troubleshooting.md#how-to-troubleshoot-issues) will help in debugging.
Author
Owner

@fks commented on GitHub (Oct 26, 2024):

Same problem with deepseek-coder-v2 here. Here are the relevant parts of the log:

Okt 26 06:14:26 gpu-workstation ollama[1532]: check_double_bos_eos: Added a BOS token to the prompt as specified by the model but the prompt also starts with a BOS token. So now the final prompt s>
Okt 26 06:14:40 gpu-workstation ollama[1532]: /go/src/github.com/ollama/ollama/llm/llama.cpp/src/llama.cpp:16940: Deepseek2 does not support K-shift
Okt 26 06:14:40 gpu-workstation ollama[248382]: Could not attach to process.  If your uid matches the uid of the target
Okt 26 06:14:40 gpu-workstation ollama[248382]: process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
Okt 26 06:14:40 gpu-workstation ollama[248382]: again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
Okt 26 06:14:40 gpu-workstation ollama[1532]: ptrace: Unpassender IOCTL (I/O-Control) für das Gerät.
Okt 26 06:14:40 gpu-workstation ollama[1532]: No stack.
Okt 26 06:14:40 gpu-workstation ollama[1532]: The program is not being run.

<!-- gh-comment-id:2439301339 --> @fks commented on GitHub (Oct 26, 2024): Same problem with deepseek-coder-v2 here. Here are the relevant parts of the log: ``` Okt 26 06:14:26 gpu-workstation ollama[1532]: check_double_bos_eos: Added a BOS token to the prompt as specified by the model but the prompt also starts with a BOS token. So now the final prompt s> Okt 26 06:14:40 gpu-workstation ollama[1532]: /go/src/github.com/ollama/ollama/llm/llama.cpp/src/llama.cpp:16940: Deepseek2 does not support K-shift Okt 26 06:14:40 gpu-workstation ollama[248382]: Could not attach to process. If your uid matches the uid of the target Okt 26 06:14:40 gpu-workstation ollama[248382]: process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try Okt 26 06:14:40 gpu-workstation ollama[248382]: again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf Okt 26 06:14:40 gpu-workstation ollama[1532]: ptrace: Unpassender IOCTL (I/O-Control) für das Gerät. Okt 26 06:14:40 gpu-workstation ollama[1532]: No stack. Okt 26 06:14:40 gpu-workstation ollama[1532]: The program is not being run. ```
Author
Owner
<!-- gh-comment-id:2439593940 --> @rick-github commented on GitHub (Oct 26, 2024): https://github.com/ollama/ollama/issues?q=is%3Aissue+is%3Aopen+Deepseek2+does+not+support+K-shift
Author
Owner

@dhiltgen commented on GitHub (Oct 31, 2024):

Dup of #5975

<!-- gh-comment-id:2450547062 --> @dhiltgen commented on GitHub (Oct 31, 2024): Dup of #5975
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#30422