dify icon indicating copy to clipboard operation
dify copied to clipboard

file url parse error?

Open zicjin opened this issue 9 months ago • 9 comments

Self Checks

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

Dify version

1.1.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

my file url:

http://10.54.108.229:7300/images/250213/32041200400220250213135937524419-11i.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=czmp-client%2F20250320%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250320T053317Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=3eef8454799f9b0643b2e21ecf7ba0bf793664fa6fb09ee81dd48207fa9d9bb3

got error:

1 validation error for File Value error, Invalid file url [type=value error, input_value={'id':None, 'tenant id'....y file' 'url': None}input type=dict] For further information visit
https://errors.pydantic.dev/2.9/v/value error

✔️ Expected Behavior

No response

❌ Actual Behavior

Image

zicjin avatar Mar 20 '25 06:03 zicjin

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

I found a similar closed issue that might be relevant to your problem: Unable to retrieve url from file. This issue was resolved by a pull request that fixed the error of being unable to retrieve the URL from a file [1].

In Dify version 1.1.0, the validation rules for file URLs require that the remote_url must be provided and must start with "http". If these conditions are not met, a ValueError is raised [2].

Given your error message, it seems there might be an issue with how the URL is being parsed or validated. Ensure that the URL is correctly formatted and starts with "http". Additionally, check if there are any network configurations in your Docker setup that might affect URL accessibility, as Dify uses an internal network setup that could influence this [3].

To continue talking to Dosu, mention @dosu.


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

dosubot[bot] avatar Mar 20 '25 06:03 dosubot[bot]

@dosubot There is no problem with the accessibility of the URL, otherwise it would not be possible to have a valid thumbnail in the Actual Behavior screenshot.

zicjin avatar Mar 20 '25 06:03 zicjin

The "Value error, Invalid file url" message occurs if the remote_url is not a string or does not start with "http" [1]. Even if the URL is accessible and displays a valid thumbnail, ensure that the URL is correctly formatted as a string and starts with "http". Double-check the URL for any hidden characters or formatting issues that might not be immediately visible.

To continue talking to Dosu, mention @dosu.


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

dosubot[bot] avatar Mar 20 '25 06:03 dosubot[bot]

same error

NDDec avatar Mar 20 '25 09:03 NDDec

same error too

deific avatar Mar 26 '25 10:03 deific

Can anyone solve it? I have such an error

mos-fine avatar Mar 28 '25 12:03 mos-fine

I also encountered this problem, and I have now identified the root cause: After a thorough investigation, I found that the issue does not occur in Dify Cloud Service version 1.1.3. Further checking the browser console, I discovered that after a file is uploaded successfully, the URL parameter returned by the Dify interface includes an http://ip:port prefix, which is absent in my locally deployed Dify. By tracing the source code of Dify, I found that Dify concatenates this prefix by reading the dify_config.FILES_URL configuration from the docker/.env.example file. I performed a global search for FILES_URL and found that this configuration item is empty by default in the docker/.env file. Therefore, I modified it to my Dify access address: http://192.168.10.14/ (if your Dify is not using port 80, please remember to add ':port number' after the IP). I hope these steps can be helpful to you!

If the same issue persists after making the modifications, here are three friendly suggestions for you to consider:

  1. Avoid using localhost; it's recommended to use the actual intranet IP address instead.
  2. If you are using proxy software, remember to turn it off before testing.
  3. After making the changes, run docker-compose down && docker-compose up -d to ensure the updates take effect.

During my use of Dify, I encountered other frequently occurring issues that were not clearly explained in the official documentation. You can check and bookmark this link for reference: Essential for Dify Development: Sharing 8 Key Techniques Not Explained in the Official Documentation

jiabaogithub avatar Apr 03 '25 03:04 jiabaogithub

thank you!


发件人: anai @.> 发送时间: 2025年4月3日 11:30 收件人: langgenius/dify @.> 抄送: Toy @.>; Manual @.> 主题: Re: [langgenius/dify] file url parse error? (Issue #16309)

[jiabaogithub]jiabaogithub left a comment (langgenius/dify#16309)https://github.com/langgenius/dify/issues/16309#issuecomment-2774377892

I also encountered this problem, and I have now identified the root cause: After a thorough investigation, I found that the issue does not occur in Dify Cloud Service version 1.1.3. Further checking the browser console, I discovered that after a file is uploaded successfully, the URL parameter returned by the Dify interface includes an http://ip:port prefix, which is absent in my locally deployed Dify. By tracing the source code of Dify, I found that Dify concatenates this prefix by reading the dify_config.FILES_URL configuration from the docker/.env.example file. I performed a global search for FILES_URL and found that this configuration item is empty by default in the docker/.env file. Therefore, I modified it to my Dify access address: http://192.168.10.14/ (if your Dify is not using port 80, please remember to add ':port number' after the IP). I hope these steps can be helpful to you! [https://camo.githubusercontent.com/cd154087bce47eca597196f8be54d415895fcfe62741973071a335bd70decea0/68747470733a2f2f776f6c61692d7365637572652d63646e2e64696e6774616c6b2e636f6d2f7374617469632f6b5539554e73485961754a6d616948686f70756332362f696d6167652e706e673f617574685f6b65793d313734333635303231302d714d6d6f42437657364e374d584c384b7164316439382d302d3237376235633931626439396132613732366639626161313431376436343435]https://camo.githubusercontent.com/cd154087bce47eca597196f8be54d415895fcfe62741973071a335bd70decea0/68747470733a2f2f776f6c61692d7365637572652d63646e2e64696e6774616c6b2e636f6d2f7374617469632f6b5539554e73485961754a6d616948686f70756332362f696d6167652e706e673f617574685f6b65793d313734333635303231302d714d6d6f42437657364e374d584c384b7164316439382d302d3237376235633931626439396132613732366639626161313431376436343435

If the same issue persists after making the modifications, here are three friendly suggestions for you to consider:

  1. Avoid using localhost; it's recommended to use the actual intranet IP address instead.
  2. If you are using proxy software, remember to turn it off before testing.
  3. After making the changes, run docker-compose down && docker-compose up -d to ensure the updates take effect.

During my use of Dify, I encountered other frequently occurring issues that were not clearly explained in the official documentation. You can check and bookmark this link for reference: Essential for Dify Development: Sharing 8 Key Techniques Not Explained in the Official Documentationhttps://mp.weixin.qq.com/s/Sl4QTOhK7VFdVFjmyck16w

― Reply to this email directly, view it on GitHubhttps://github.com/langgenius/dify/issues/16309#issuecomment-2774377892, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUCGIT34EXYAFPR22L6FEKL2XSTLVAVCNFSM6AAAAABZMT2QR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONZUGM3TOOBZGI. You are receiving this because you are subscribed to this thread.

Toy-data avatar Apr 03 '25 03:04 Toy-data

I have the same problem

Image

[volcengine_maas] Error: PluginInvokeError: {"args":{},"error_type":"ArkBadRequestError","message":"Error code: 400 - {'error': {'code': 'InvalidParameter.UnsupportedImageFormat', 'message': 'The request failed because the image format is not supported by the API. Request id: 02174441864151118eed0f78db1b735472d7048ab7ee678f7944c', 'param': 'image_url', 'type': 'BadRequest'}}, request_id: 20250412084401vc8StqpH6p32fw3xsvDx"}

Image

filwu8 avatar Apr 12 '25 01:04 filwu8