mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
invalid memory address or nil pointer dereference #340
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @qq1002517 on GitHub (Jun 5, 2025).
Self Checks
Dify version
1.4.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
I used Docker to deploy DIY (which can be connected to the internet) on my Mac system, and everything runs normally. I have another Linux server on the intranet, and when I want to use dify, I do it this way.
✔️ Expected Behavior
I have configured many models in the "OpenAI-API compatible" section of the Mac system. I believe that by copying the dify-1.4.1/dock directory to the Linux machine, the new machine should display the corresponding models. I confirm that my Linux can access these model services. I think these contents should be stored in the PG database. And the dify-1.4.1/docker/volumes/db directory should contain all data information
❌ Actual Behavior
there is no model configured by me in the “OpenAI-API compatible” model list.
The log is as follows
It's done
@dosubot[bot] commented on GitHub (Jun 5, 2025):
Hi @qq1002517! I'm Dosu and I’m helping the dify team.
The error you're seeing ("invalid memory address or nil pointer dereference") is often caused by missing or misconfigured data, especially when moving Docker volumes or databases between systems. In Dify, model configurations are stored in the PostgreSQL database, which is mounted as a Docker volume. If the volume wasn't copied or mounted correctly on your Linux server, the application may not find your models, and attempts to access missing data can trigger this kind of error.
Here are the most likely causes and what you can check:
docker/volumes/db/datadirectory from your Mac were copied to the same path on your Linux server, and that the Docker Compose file on Linux is mounting this directory correctly..envfile and Docker Compose configuration to ensure all environment variables (especially database credentials and paths) are correct and match your previous setup.If after checking these points the issue persists, try inspecting the database container logs for errors on startup, and verify that the expected tables and data exist in the database. This will help confirm whether the data migration was successful.
Let me know if you need more specific troubleshooting steps for any of these checks.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

@qq1002517 commented on GitHub (Jun 5, 2025):
@dosu,I check my file and diff two system .It's seems same. the other,I kown the pg db contain two scheme that is dify and dify_plugin.I confirm that my file is complete and correctly mounted。Because I can see all my installed plugins in the plugin list.But I can't see the already configured model, and I can't see it even after reconfiguring it. I only have the error message provided last time.
I will try to restore. env to default later, but I want to know which model data is stored in which table of PG. I will check the database. Can you tell me the table name? @dosu
@dosubot[bot] commented on GitHub (Jun 5, 2025):
Model configuration data is stored in the following PostgreSQL tables under the dify schema: app_model_configs (main model configs), provider_models (API provider models and their configs), provider_model_settings (model enabled/load balancing status), and load_balancing_model_configs (load balancing configs) [source][source]. These are not in the dify_plugin schema.
To check if your model data is present, you can connect to your PostgreSQL instance and run, for example:
If these tables are empty or missing expected entries, it likely means the migration or volume mount did not bring over your model data. If you see your plugins but not your models, focus on these tables for troubleshooting.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

@qq1002517 commented on GitHub (Jun 5, 2025):
hi @dosu ,thank you for table_name.
langgenius/openai_api_compatible version is 0.0.16
@qq1002517 commented on GitHub (Jun 9, 2025):
@dosu,I want to know if it is necessary to have a Python environment when dify is running offline
@yang-y-f commented on GitHub (Jun 12, 2025):
hi. I meet the same question. Have you solved it?
@qq1002517 commented on GitHub (Jun 12, 2025):
It's a bad message,I can't solv it. and the plugin system is a big and bad idea. from 1.1.0 ,all question is it made.
@liyunhan commented on GitHub (Jun 20, 2025):
Meet same error!
@liyunhan commented on GitHub (Jun 20, 2025):
@dosu How to resolve this problem? Nobody cares?
@liyunhan commented on GitHub (Jun 20, 2025):
@qq1002517 我看了正常volumes下的目录结构,在plugin_daemon的,比如openai_api_compatible的.venv/bin目录下是有python -> /usr/bin/python3.12这样的软链接在,但是通过打包的方式迁移到目标机器时,这些软链接都丢了,不知道和这个有没有关系
@qq1002517 commented on GitHub (Jun 26, 2025):
实验了,把软连都建起来重启一样。我这git抽风不定期能访问。
@liyunhan commented on GitHub (Jun 26, 2025):
别在宿主机新建软链接,它的环境都在docker容器内,建软链接也要进容器内建才有可能建正确。我这边最后的解决方案是迁移时用tar czvf 打包整个dify的目录(里面应该包括vloumes这些各种目录,就是官方提供的那个docker文件夹),它会自动保留所有软链接,这样再docker compose up -d启动就没问题了。你可以再试试看行不行
@liyunhan commented on GitHub (Jun 26, 2025):
当然我不确定你面对的问题是不是完全和我一样....至少从报错上看可能是一样的,我的确是解决了软链接就没再遇到这个问题。
@qq1002517 commented on GitHub (Jun 26, 2025):
我明天试试 我当时用的是zip压缩,在服务器上解压之后发现软连接没了 所以重建了 但是并没解决问题。
@AlexMoxie commented on GitHub (Jul 3, 2025):
set PIP_MIRROR_URL=https://pypi.tuna.tsinghua.edu.cn/simple in .env and reload dify
@qq1002517 commented on GitHub (Jul 3, 2025):
I 'm offline。
@AlexMoxie commented on GitHub (Jul 3, 2025):
host a your own simple repository.
@qq1002517 commented on GitHub (Jul 9, 2025):
感谢,可以了。@all 离线就这么干。但是不要用zip 一定要用 tar -zcvf
@liyunhan commented on GitHub (Jul 10, 2025):
哈哈,我一开始也是zip的,后面发现了这个情况就尝试用tar,心路历程都一样。
@dosubot[bot] commented on GitHub (Aug 21, 2025):
Hi, @qq1002517. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.
Issue Summary:
Next Steps:
Thank you for your understanding and contribution!
@outhereter commented on GitHub (Sep 5, 2025):
@qq1002517 @liyunhan
这几天我也遇到了同样的问题,感觉上在有些硬件环境下,不一定会发生这个问题。
不知道是硬件问题,还是在特定的硬件下plugin才会发生问题,我感到很困惑。
首先,我把下面的参数已经设置得很大了,但是后台log来看并没有等待这么久,我感觉最多等了不到5分钟就报错了,并没有等满到我设置的时间(也许不是这个地方起作用)。
PLUGIN_PYTHON_ENV_INIT_TIMEOUT=3200
PLUGIN_MAX_EXECUTION_TIMEOUT=3200
另外,不管是在windows,linux(wsl 虚拟环境)下,.venv都不会被打进zip,7z,tar里面怎么都会报错(不知道是不是我方法不对)。
我是半个月前才开始使用接触dify,以及docker来做一个客户的调研任务,所以下面解决办法,只是我的个人操做的结果,
不代表是一定就是客观事实,仅供参考。
请注意我的办法,只是让它跑起来了,感觉方法很恶心,但是没法要交差,出此下策
下面是我的恶心办法
注意: 下面的Step2開始的所有步骤都要全程启动着docker-plugin_daemon-1容器,只到插件正常安装完毕
Step1. plugin_daemon 下的volumes里加一个临时的文件夹后,docker compose down -> up -d
volumes:
- ./volumes/plugin_daemon:/app/storage <- 缺省的
- ./volumes/plugin_daemon_tmp:/app/storage_tmp <- 新加的
Step2. 进入docker的docker-plugin_daemon-1容器的bash命令行,建立临时plugin构造venv环境的目录,复制原始目录里除了.venv文件夹以外的所有内容
※我把关键的执行内容贴上来(linux也不太懂,完全是试出来的)
执行:
docker exec -it docker-plugin_daemon-1 /bin/bash
进来后是下面这个样子:
mkdir -p storage_tmp/azure_openai
root@cbf021e1dfa7:/app/storage/cwd/langgenius/azure_openai-0.0.28@9b0339feb86b34393abd921e9cc906192fc46daad3a0f15c1d2a35ba20e8f704# tar --exclude='./.venv' -cf - . | (cd /app/storage_tmp/azure_openai && tar -xf -)
这里有点慢,执行完了会有下面的样子:
Step3. 手动启动虚拟环境,并手动安装package
root@cbf021e1dfa7:/app/storage_tmp/azure_openai# source .venv/bin/activate
(.venv) root@cbf021e1dfa7:/app/storage_tmp/azure_openai# uv pip install -r requirements.txt
不知道是不是公司网络限制,非常的慢,我花了一个小时,才执行完,下面的样子:
Step4. 手动把零时文件夹的package文件夹拷贝到,真正的plugin文件夹里面去
① .venv\lib\python3.12\site-packages
Dify_Work\dify\docker\volumes\plugin_daemon_tmp\azure_openai.venv\lib\python3.12\site-packages
↓
C:\Users\Z-ROOSTER03\Desktop\Dify_Work\dify\docker\volumes\plugin_daemon\cwd\langgenius\azure_openai-0.0.28@9b0339feb86b34393abd921e9cc906192fc46daad3a0f15c1d2a35ba20e8f704.venv\lib\python3.12\site-packages
※我linux不熟,直接通过windows的文件夹拷贝进行的,这一步可能因为文件路径太长了,有一些版权声明文件放不进去我就无视了
② .venv\include (这个目录我在我的原始目录里没有,所以也拷贝了,有没有用不知道)
C:\Users\Z-ROOSTER03\Desktop\Dify_Work\dify\docker\volumes\plugin_daemon_tmp\azure_openai.venv\include
↓
C:\Users\Z-ROOSTER03\Desktop\Dify_Work\dify\docker\volumes\plugin_daemon\cwd\langgenius\azure_openai-0.0.28@9b0339feb86b34393abd921e9cc906192fc46daad3a0f15c1d2a35ba20e8f704.venv\include
Step5. 等待plugin预编译
我的windows desktop 的log如下表示:
※到我拷贝中,plugin也同时在尝试初始化,但是当拷贝完时,我看见了 "[INFO]pre-compiling langgenius/azure_openai:0.0.28" 开始的log, 知道最后的成功。我在画面上的插件也正常能运行了。