file id is null #7955

Closed
opened 2026-02-21 18:23:13 -05:00 by yindo · 7 comments
Owner

Originally created by @HuChundong on GitHub (Feb 2, 2025).

Originally assigned to: @laipz8200 on GitHub.

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

0.15.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

a min dsl to show this issue:

app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: advanced-chat
  name: test
  use_icon_as_answer_icon: false
kind: app
version: 0.1.5
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      allowed_file_extensions:
      - .JPG
      - .JPEG
      - .PNG
      - .GIF
      - .WEBP
      - .SVG
      allowed_file_types:
      - image
      allowed_file_upload_methods:
      - local_file
      - remote_url
      enabled: false
      fileUploadConfig:
        audio_file_size_limit: 50
        batch_count_limit: 5
        file_size_limit: 15
        image_file_size_limit: 10
        video_file_size_limit: 100
        workflow_file_upload_limit: 10
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
        - remote_url
      number_limits: 3
    opening_statement: ''
    retriever_resource:
      enabled: true
    sensitive_word_avoidance:
      enabled: false
    speech_to_text:
      enabled: false
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
      language: ''
      voice: ''
  graph:
    edges:
    - data:
        isInIteration: false
        sourceType: start
        targetType: tool
      id: 1738532363024-source-1738532389502-target
      source: '1738532363024'
      sourceHandle: source
      target: '1738532389502'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: tool
        targetType: answer
      id: 1738532389502-source-answer-target
      source: '1738532389502'
      sourceHandle: source
      target: answer
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables:
        - allowed_file_extensions: []
          allowed_file_types:
          - image
          - document
          - audio
          - video
          allowed_file_upload_methods:
          - local_file
          - remote_url
          label: user_file
          max_length: 48
          options: []
          required: false
          type: file
          variable: user_file
      height: 89
      id: '1738532363024'
      position:
        x: 80
        y: 282
      positionAbsolute:
        x: 80
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: '{{#1738532389502.text#}}'
        desc: ''
        selected: false
        title: 直接回复
        type: answer
        variables: []
      height: 102
      id: answer
      position:
        x: 763.1289983786921
        y: 272.76344462458974
      positionAbsolute:
        x: 763.1289983786921
        y: 272.76344462458974
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        provider_id: 6192c406-fe54-40ce-973a-50b568301c2c
        provider_name: 封装返回结构
        provider_type: workflow
        selected: false
        title: 封装返回结构
        tool_configurations: {}
        tool_label: 封装返回结构
        tool_name: pack_response
        tool_parameters:
          files:
            type: variable
            value:
            - '1738532363024'
            - user_file
          response:
            type: mixed
            value: test
          status:
            type: constant
            value: 0
        type: tool
      height: 53
      id: '1738532389502'
      position:
        x: 422.99307122794414
        y: 296.1918580055515
      positionAbsolute:
        x: 422.99307122794414
        y: 296.1918580055515
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    viewport:
      x: 60.35141579483934
      y: 222.44530247148222
      zoom: 0.7578582832551992

✔️ Expected Behavior

when i upload file, the id is null, but when i use this file as param, error report: Run failed: Failed to invoke tool: Invalid upload file id
web and api both report this issue.

{
"user_file": {
"dify_model_identity": "dify__file",
"id": null,
"tenant_id": "c6165e3a-fb17-48cb-aa03-fc0db568fd71",
"type": "document",
"transfer_method": "local_file",
"remote_url": "",
"related_id": "f03a14aa-0986-424a-8112-c12ec162872f",
"filename": "api-doc.txt",
"extension": ".txt",
"mime_type": "text/plain",
"size": 18081,
"url": "/files/f03a14aa-0986-424a-8112-c12ec162872f/file-preview?timestamp=1738532135&nonce=464b7957014d5649ee113ed8bdd61c1a&sign=Y2rUMWbi9AYIHw1rKw8zT_Fv0FY9A7RmlUHRMTOhh3s="
},
"sys.query": "dd",
"sys.files": [],
"sys.conversation_id": "e0258f20-7541-4fea-9526-48f72c2b548e",
"sys.user_id": "7743e2d7-cf48-426e-9a4a-05c58b289e03",
"sys.dialogue_count": 0,
"sys.app_id": "88910469-0772-4ec6-b742-93de4e0196b7",
"sys.workflow_id": "4aba5c71-4706-42de-81a8-902cb84ccccc",
"sys.workflow_run_id": "b25ca1a2-144c-4def-a04c-cf8f1e2ddc02"
}

Actual Behavior

No response

Originally created by @HuChundong on GitHub (Feb 2, 2025). Originally assigned to: @laipz8200 on GitHub. ### 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 0.15.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce a min dsl to show this issue: ``` yaml app: description: '' icon: 🤖 icon_background: '#FFEAD5' mode: advanced-chat name: test use_icon_as_answer_icon: false kind: app version: 0.1.5 workflow: conversation_variables: [] environment_variables: [] features: file_upload: allowed_file_extensions: - .JPG - .JPEG - .PNG - .GIF - .WEBP - .SVG allowed_file_types: - image allowed_file_upload_methods: - local_file - remote_url enabled: false fileUploadConfig: audio_file_size_limit: 50 batch_count_limit: 5 file_size_limit: 15 image_file_size_limit: 10 video_file_size_limit: 100 workflow_file_upload_limit: 10 image: enabled: false number_limits: 3 transfer_methods: - local_file - remote_url number_limits: 3 opening_statement: '' retriever_resource: enabled: true sensitive_word_avoidance: enabled: false speech_to_text: enabled: false suggested_questions: [] suggested_questions_after_answer: enabled: false text_to_speech: enabled: false language: '' voice: '' graph: edges: - data: isInIteration: false sourceType: start targetType: tool id: 1738532363024-source-1738532389502-target source: '1738532363024' sourceHandle: source target: '1738532389502' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: tool targetType: answer id: 1738532389502-source-answer-target source: '1738532389502' sourceHandle: source target: answer targetHandle: target type: custom zIndex: 0 nodes: - data: desc: '' selected: false title: 开始 type: start variables: - allowed_file_extensions: [] allowed_file_types: - image - document - audio - video allowed_file_upload_methods: - local_file - remote_url label: user_file max_length: 48 options: [] required: false type: file variable: user_file height: 89 id: '1738532363024' position: x: 80 y: 282 positionAbsolute: x: 80 y: 282 selected: false sourcePosition: right targetPosition: left type: custom width: 243 - data: answer: '{{#1738532389502.text#}}' desc: '' selected: false title: 直接回复 type: answer variables: [] height: 102 id: answer position: x: 763.1289983786921 y: 272.76344462458974 positionAbsolute: x: 763.1289983786921 y: 272.76344462458974 selected: true sourcePosition: right targetPosition: left type: custom width: 243 - data: desc: '' provider_id: 6192c406-fe54-40ce-973a-50b568301c2c provider_name: 封装返回结构 provider_type: workflow selected: false title: 封装返回结构 tool_configurations: {} tool_label: 封装返回结构 tool_name: pack_response tool_parameters: files: type: variable value: - '1738532363024' - user_file response: type: mixed value: test status: type: constant value: 0 type: tool height: 53 id: '1738532389502' position: x: 422.99307122794414 y: 296.1918580055515 positionAbsolute: x: 422.99307122794414 y: 296.1918580055515 selected: false sourcePosition: right targetPosition: left type: custom width: 243 viewport: x: 60.35141579483934 y: 222.44530247148222 zoom: 0.7578582832551992 ``` ### ✔️ Expected Behavior **when i upload file, the id is null, but when i use this file as param, error report: Run failed: Failed to invoke tool: Invalid upload file id** web and api both report this issue. { "user_file": { "dify_model_identity": "__dify__file__", "id": null, "tenant_id": "c6165e3a-fb17-48cb-aa03-fc0db568fd71", "type": "document", "transfer_method": "local_file", "remote_url": "", "related_id": "f03a14aa-0986-424a-8112-c12ec162872f", "filename": "api-doc.txt", "extension": ".txt", "mime_type": "text/plain", "size": 18081, "url": "/files/f03a14aa-0986-424a-8112-c12ec162872f/file-preview?timestamp=1738532135&nonce=464b7957014d5649ee113ed8bdd61c1a&sign=Y2rUMWbi9AYIHw1rKw8zT_Fv0FY9A7RmlUHRMTOhh3s=" }, "sys.query": "dd", "sys.files": [], "sys.conversation_id": "e0258f20-7541-4fea-9526-48f72c2b548e", "sys.user_id": "7743e2d7-cf48-426e-9a4a-05c58b289e03", "sys.dialogue_count": 0, "sys.app_id": "88910469-0772-4ec6-b742-93de4e0196b7", "sys.workflow_id": "4aba5c71-4706-42de-81a8-902cb84ccccc", "sys.workflow_run_id": "b25ca1a2-144c-4def-a04c-cf8f1e2ddc02" } ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-21 18:23:13 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 2, 2025):

Hello, @HuChundong! I'm here to help you with any bugs, questions, or contributions you have in mind. Let's tackle this issue together!

A file ID being null after an upload attempt in the Dify platform can occur due to several reasons. Here are some potential causes and checks you can perform:

  1. File Upload Configuration: Ensure that the file upload feature is enabled in your workflow configuration. In your provided configuration, file_upload is set to enabled: false. This needs to be set to true to allow file uploads.

  2. Allowed File Types and Extensions: Verify that the file type and extension you are trying to upload are included in the allowed_file_types and allowed_file_extensions lists. Your configuration allows image types, but the uploaded file is a document (.txt), which might not be permitted.

  3. File Size and Limits: Check if the file size exceeds the configured limits. The file_size_limit is set to 15MB, so ensure the file is within this limit.

  4. User Permissions: Ensure that the user has the necessary permissions to upload files, especially if the source is "datasets".

  5. Error Handling and Logging: Check the logs for any error messages related to the file upload process. This can provide more insight into why the file ID is null.

  6. File Presence and Count: Ensure that exactly one file is being uploaded. If no file is uploaded or more than one file is uploaded, it could result in a null ID.

By addressing these areas, you should be able to identify the cause of the null file ID and resolve the issue.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Feb 2, 2025): <!-- Greeting --> Hello, @HuChundong! I'm here to help you with any bugs, questions, or contributions you have in mind. Let's tackle this issue together! <!-- Answer --> A file ID being null after an upload attempt in the Dify platform can occur due to several reasons. Here are some potential causes and checks you can perform: 1. **File Upload Configuration**: Ensure that the file upload feature is enabled in your workflow configuration. In your provided configuration, `file_upload` is set to `enabled: false`. This needs to be set to `true` to allow file uploads. 2. **Allowed File Types and Extensions**: Verify that the file type and extension you are trying to upload are included in the `allowed_file_types` and `allowed_file_extensions` lists. Your configuration allows image types, but the uploaded file is a document (`.txt`), which might not be permitted. 3. **File Size and Limits**: Check if the file size exceeds the configured limits. The `file_size_limit` is set to 15MB, so ensure the file is within this limit. 4. **User Permissions**: Ensure that the user has the necessary permissions to upload files, especially if the source is "datasets". 5. **Error Handling and Logging**: Check the logs for any error messages related to the file upload process. This can provide more insight into why the file ID is null. 6. **File Presence and Count**: Ensure that exactly one file is being uploaded. If no file is uploaded or more than one file is uploaded, it could result in a null ID. By addressing these areas, you should be able to identify the cause of the null file ID and resolve the issue. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/6f73f898-98b7-4aa2-a781-5267c392d6cd?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/6f73f898-98b7-4aa2-a781-5267c392d6cd?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/6f73f898-98b7-4aa2-a781-5267c392d6cd?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/6f73f898-98b7-4aa2-a781-5267c392d6cd?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6f73f898-98b7-4aa2-a781-5267c392d6cd?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/6f73f898-98b7-4aa2-a781-5267c392d6cd?feedback_type=other)</sup>
Author
Owner

@HuChundong commented on GitHub (Feb 2, 2025):

i have change my chatflow. but it not help. because the file id is still null.

app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: advanced-chat
  name: test
  use_icon_as_answer_icon: false
kind: app
version: 0.1.5
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      allowed_file_extensions:
      - .txt
      allowed_file_types:
      - video
      - audio
      - image
      - document
      allowed_file_upload_methods:
      - remote_url
      - local_file
      enabled: true
      fileUploadConfig:
        audio_file_size_limit: 50
        batch_count_limit: 5
        file_size_limit: 15
        image_file_size_limit: 10
        video_file_size_limit: 100
        workflow_file_upload_limit: 10
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
        - remote_url
      number_limits: 1
    opening_statement: ''
    retriever_resource:
      enabled: true
    sensitive_word_avoidance:
      enabled: false
    speech_to_text:
      enabled: false
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
      language: ''
      voice: ''
  graph:
    edges:
    - data:
        isInIteration: false
        sourceType: start
        targetType: tool
      id: 1738532363024-source-1738532389502-target
      source: '1738532363024'
      sourceHandle: source
      target: '1738532389502'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: tool
        targetType: answer
      id: 1738532389502-source-answer-target
      source: '1738532389502'
      sourceHandle: source
      target: answer
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: true
        title: 开始
        type: start
        variables:
        - allowed_file_extensions: []
          allowed_file_types:
          - image
          - document
          - audio
          - video
          allowed_file_upload_methods:
          - local_file
          - remote_url
          label: user_file
          max_length: 48
          options: []
          required: false
          type: file
          variable: user_file
      height: 89
      id: '1738532363024'
      position:
        x: 80
        y: 280.6804920892271
      positionAbsolute:
        x: 80
        y: 280.6804920892271
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: '{{#1738532389502.text#}}'
        desc: ''
        selected: false
        title: 直接回复
        type: answer
        variables: []
      height: 102
      id: answer
      position:
        x: 763.1289983786921
        y: 272.76344462458974
      positionAbsolute:
        x: 763.1289983786921
        y: 272.76344462458974
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        provider_id: 6192c406-fe54-40ce-973a-50b568301c2c
        provider_name: 封装返回结构
        provider_type: workflow
        selected: false
        title: 封装返回结构
        tool_configurations: {}
        tool_label: 封装返回结构
        tool_name: pack_response
        tool_parameters:
          files:
            type: variable
            value:
            - '1738532363024'
            - user_file
          response:
            type: mixed
            value: test
          status:
            type: constant
            value: 0
        type: tool
      height: 53
      id: '1738532389502'
      position:
        x: 422.99307122794414
        y: 296.1918580055515
      positionAbsolute:
        x: 422.99307122794414
        y: 296.1918580055515
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    viewport:
      x: 191.99125013167668
      y: 186.08042124219423
      zoom: 0.870550563296124

`
@HuChundong commented on GitHub (Feb 2, 2025): i have change my chatflow. but it not help. because the file id is still null. ``` yaml app: description: '' icon: 🤖 icon_background: '#FFEAD5' mode: advanced-chat name: test use_icon_as_answer_icon: false kind: app version: 0.1.5 workflow: conversation_variables: [] environment_variables: [] features: file_upload: allowed_file_extensions: - .txt allowed_file_types: - video - audio - image - document allowed_file_upload_methods: - remote_url - local_file enabled: true fileUploadConfig: audio_file_size_limit: 50 batch_count_limit: 5 file_size_limit: 15 image_file_size_limit: 10 video_file_size_limit: 100 workflow_file_upload_limit: 10 image: enabled: false number_limits: 3 transfer_methods: - local_file - remote_url number_limits: 1 opening_statement: '' retriever_resource: enabled: true sensitive_word_avoidance: enabled: false speech_to_text: enabled: false suggested_questions: [] suggested_questions_after_answer: enabled: false text_to_speech: enabled: false language: '' voice: '' graph: edges: - data: isInIteration: false sourceType: start targetType: tool id: 1738532363024-source-1738532389502-target source: '1738532363024' sourceHandle: source target: '1738532389502' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: tool targetType: answer id: 1738532389502-source-answer-target source: '1738532389502' sourceHandle: source target: answer targetHandle: target type: custom zIndex: 0 nodes: - data: desc: '' selected: true title: 开始 type: start variables: - allowed_file_extensions: [] allowed_file_types: - image - document - audio - video allowed_file_upload_methods: - local_file - remote_url label: user_file max_length: 48 options: [] required: false type: file variable: user_file height: 89 id: '1738532363024' position: x: 80 y: 280.6804920892271 positionAbsolute: x: 80 y: 280.6804920892271 selected: true sourcePosition: right targetPosition: left type: custom width: 243 - data: answer: '{{#1738532389502.text#}}' desc: '' selected: false title: 直接回复 type: answer variables: [] height: 102 id: answer position: x: 763.1289983786921 y: 272.76344462458974 positionAbsolute: x: 763.1289983786921 y: 272.76344462458974 selected: false sourcePosition: right targetPosition: left type: custom width: 243 - data: desc: '' provider_id: 6192c406-fe54-40ce-973a-50b568301c2c provider_name: 封装返回结构 provider_type: workflow selected: false title: 封装返回结构 tool_configurations: {} tool_label: 封装返回结构 tool_name: pack_response tool_parameters: files: type: variable value: - '1738532363024' - user_file response: type: mixed value: test status: type: constant value: 0 type: tool height: 53 id: '1738532389502' position: x: 422.99307122794414 y: 296.1918580055515 positionAbsolute: x: 422.99307122794414 y: 296.1918580055515 selected: false sourcePosition: right targetPosition: left type: custom width: 243 viewport: x: 191.99125013167668 y: 186.08042124219423 zoom: 0.870550563296124 `
Author
Owner

@crazywoola commented on GitHub (Feb 2, 2025):

If you want to to get file id, please use the related_id instead.

https://github.com/langgenius/dify/blob/b66c03dfe960fd439a8240e25074eeef357a0d3d/api/core/tools/tool/workflow_tool.py#L170-L175

@crazywoola commented on GitHub (Feb 2, 2025): If you want to to get `file id`, please use the `related_id` instead. https://github.com/langgenius/dify/blob/b66c03dfe960fd439a8240e25074eeef357a0d3d/api/core/tools/tool/workflow_tool.py#L170-L175
Author
Owner

@HuChundong commented on GitHub (Feb 2, 2025):

The issue is not the absence of a file id, but rather the missing file id, which will cause errors in next nodes that use the file. You can use the DSL above for testing.

@HuChundong commented on GitHub (Feb 2, 2025): The issue is not the absence of a file id, but rather the missing file id, which will cause errors in next nodes that use the file. You can use the DSL above for testing.
Author
Owner

@HuChundong commented on GitHub (Feb 2, 2025):

NEED REOPEN ISSUE

@HuChundong commented on GitHub (Feb 2, 2025): NEED REOPEN ISSUE
Author
Owner

@Modas-Li commented on GitHub (Apr 9, 2025):

NEED REOPEN ISSUE

same request

@Modas-Li commented on GitHub (Apr 9, 2025): > NEED REOPEN ISSUE same request
Author
Owner

@coolcoolstruttin-sys commented on GitHub (Sep 16, 2025):

I would like to add more details to this issue.

  • Tested on both Free (Sandbox) and Professional plan → the same problem occurs.
  • Tried different file types (CSV, PNG image, etc.) → all return "id": null.
  • Storage usage is empty (0/50MB in Sandbox, 0/5GB in Professional), so it's not caused by quota limits.
  • Workflow is very simple: Start node with a single file input. No legacy sys.files. Still the same issue.

So it seems this is not related to plan restrictions or file type, but a bug in the cloud environment itself.

Could you please check and confirm?

@coolcoolstruttin-sys commented on GitHub (Sep 16, 2025): I would like to add more details to this issue. - Tested on **both Free (Sandbox) and Professional plan** → the same problem occurs. - Tried **different file types** (CSV, PNG image, etc.) → all return `"id": null`. - **Storage usage is empty** (0/50MB in Sandbox, 0/5GB in Professional), so it's not caused by quota limits. - Workflow is very simple: Start node with a single file input. No legacy `sys.files`. Still the same issue. So it seems this is not related to plan restrictions or file type, but a bug in the cloud environment itself. Could you please check and confirm?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7955