When I was developing a Dify plugin and using the “model-selector” parameter type, an error occurred. #14452

Closed
opened 2026-02-21 19:17:18 -05:00 by yindo · 3 comments
Owner

Originally created by @huangxttttt on GitHub (Jun 5, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.2.0

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

TypeError: Cannot read properties of null (reading 'split')
    at ModelParameterModal (webpack-internal:///(app-pages-browser)/./app/components/plugins/plugin-detail-panel/model-selector/index.tsx:39:30)
    at renderField (webpack-internal:///(app-pages-browser)/./app/components/header/account-setting/model-provider-page/model-modal/Form.tsx:437:96)
    at eval (webpack-internal:///(app-pages-browser)/./app/components/header/account-setting/model-provider-page/model-modal/Form.tsx:626:49)
    at Array.map (<anonymous>)
    at Form (webpack-internal:///(app-pages-browser)/./app/components/header/account-setting/model-provider-page/model-modal/Form.tsx:626:31)
    at ConfigCredential (webpack-internal:///(app-pages-browser)/./app/components/tools/setting/build-in/config-credentials.tsx:100:96)
    at ActionList (webpack-internal:///(app-pages-browser)/./app/components/plugins/plugin-detail-panel/action-list.tsx:146:107)
    at PluginDetailPanel (webpack-internal:///(app-pages-browser)/./app/components/plugins/plugin-detail-panel/index.tsx:57:129)
    at PluginsPanel (webpack-internal:///(app-pages-browser)/./app/components/plugins/plugin-page/plugins-panel.tsx:170:88)
    at PluginList (rsc://React/Server/webpack-internal:///(rsc)/./app/(commonLayout)/plugins/page.tsx?25:19:93)

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @huangxttttt on GitHub (Jun 5, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.2.0 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce ``` TypeError: Cannot read properties of null (reading 'split') at ModelParameterModal (webpack-internal:///(app-pages-browser)/./app/components/plugins/plugin-detail-panel/model-selector/index.tsx:39:30) at renderField (webpack-internal:///(app-pages-browser)/./app/components/header/account-setting/model-provider-page/model-modal/Form.tsx:437:96) at eval (webpack-internal:///(app-pages-browser)/./app/components/header/account-setting/model-provider-page/model-modal/Form.tsx:626:49) at Array.map (<anonymous>) at Form (webpack-internal:///(app-pages-browser)/./app/components/header/account-setting/model-provider-page/model-modal/Form.tsx:626:31) at ConfigCredential (webpack-internal:///(app-pages-browser)/./app/components/tools/setting/build-in/config-credentials.tsx:100:96) at ActionList (webpack-internal:///(app-pages-browser)/./app/components/plugins/plugin-detail-panel/action-list.tsx:146:107) at PluginDetailPanel (webpack-internal:///(app-pages-browser)/./app/components/plugins/plugin-detail-panel/index.tsx:57:129) at PluginsPanel (webpack-internal:///(app-pages-browser)/./app/components/plugins/plugin-page/plugins-panel.tsx:170:88) at PluginList (rsc://React/Server/webpack-internal:///(rsc)/./app/(commonLayout)/plugins/page.tsx?25:19:93) ``` ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 19:17:18 -05:00
yindo closed this issue 2026-02-21 19:17:18 -05:00
Author
Owner

@huangxttttt commented on GitHub (Jun 5, 2025):

const ModelParameterModal: FC<ModelParameterModalProps> = ({ popupClassName, portalToFollowElemContentClassName, isAdvancedMode, value, setModel, renderTrigger, readonly, isInWorkflow, isAgentStrategy, scope = ModelTypeEnum.textGeneration, }) => { const { t } = useTranslation() const { isAPIKeySet } = useProviderContext() const [open, setOpen] = useState(false) const scopeArray = scope.split('&') const scopeFeatures = useMemo(() => {

Why is the scope null?

@huangxttttt commented on GitHub (Jun 5, 2025): `const ModelParameterModal: FC<ModelParameterModalProps> = ({ popupClassName, portalToFollowElemContentClassName, isAdvancedMode, value, setModel, renderTrigger, readonly, isInWorkflow, isAgentStrategy, scope = ModelTypeEnum.textGeneration, }) => { const { t } = useTranslation() const { isAPIKeySet } = useProviderContext() const [open, setOpen] = useState(false) const scopeArray = scope.split('&') const scopeFeatures = useMemo(() => {` Why is the scope null?
Author
Owner

@dosubot[bot] commented on GitHub (Jun 5, 2025):

The reason you're seeing scope as null is that the ModelParameterModal component defines scope as an optional prop, but it's not actually used or set anywhere in the component or its parent code. If nothing passes a value for scope, it defaults to undefined (or null), which causes scope.split('&') to throw an error. This is a common pitfall when optional props are not handled defensively.

To avoid this, make sure that when you use ModelParameterModal, you always pass a valid string for scope, or update the component to handle cases where scope is null or undefined (for example, by using scope?.split('&') or providing a default value).

Also, if you're configuring a plugin with the model-selector parameter type, double-check your YAML config. There are known issues if the form field is set incorrectly—make sure it's set to form, not llm, to avoid related errors with model selection and parameter handling [1] [2].

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Jun 5, 2025): <!-- Answer --> The reason you're seeing scope as null is that the ModelParameterModal component defines scope as an optional prop, but it's not actually used or set anywhere in the component or its parent code. If nothing passes a value for scope, it defaults to undefined (or null), which causes scope.split('&') to throw an error. This is a common pitfall when optional props are not handled defensively. To avoid this, make sure that when you use ModelParameterModal, you always pass a valid string for scope, or update the component to handle cases where scope is null or undefined (for example, by using scope?.split('&') or providing a default value). Also, if you're configuring a plugin with the model-selector parameter type, double-check your YAML config. There are known issues if the form field is set incorrectly—make sure it's set to form, not llm, to avoid related errors with model selection and parameter handling [[1]](https://github.com/langgenius/dify/issues/18650) [[2]](https://github.com/langgenius/dify/issues/15631). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/60407f5f-6fce-408b-9ecd-91e1f8956d4e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/60407f5f-6fce-408b-9ecd-91e1f8956d4e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/60407f5f-6fce-408b-9ecd-91e1f8956d4e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/60407f5f-6fce-408b-9ecd-91e1f8956d4e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/60407f5f-6fce-408b-9ecd-91e1f8956d4e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/60407f5f-6fce-408b-9ecd-91e1f8956d4e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/60407f5f-6fce-408b-9ecd-91e1f8956d4e?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/20727)
Author
Owner

@crazywoola commented on GitHub (Jun 6, 2025):

We do not provide technical support for starting from the source. Thank you for your understanding. We assume you have the necessary expertise to set it up independently. If you require technical support, please obtain our business license by contacting us at business@dify.ai.

@crazywoola commented on GitHub (Jun 6, 2025): We do not provide technical support for starting from the source. Thank you for your understanding. We assume you have the necessary expertise to set it up independently. If you require technical support, please obtain our business license by contacting us at business@dify.ai.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#14452