Firecrawl Tool:Expecting value: line 1 column 1 (char 0) #6085

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

Originally created by @louisLiu1004 on GitHub (Oct 14, 2024).

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.9.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Using Firecrawl (Self Hosted Docker) to request any website from any node.

✔️ Expected Behavior

Crawl and read the returned webpage content.

Actual Behavior

image

Originally created by @louisLiu1004 on GitHub (Oct 14, 2024). ### 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.9.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Using Firecrawl (Self Hosted Docker) to request any website from any node. ### ✔️ Expected Behavior Crawl and read the returned webpage content. ### ❌ Actual Behavior ![image](https://github.com/user-attachments/assets/d4a85dca-0044-4dc0-9040-75da2e64ea7b)
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 18:14:01 -05:00
yindo closed this issue 2026-02-21 18:14:01 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 14, 2024):

@louisLiu1004 Hello there! I'm here to assist you with bug fixes, questions, and contributing to the project. Let's work together to resolve any issues you encounter while waiting for a human maintainer.

I found a similar discussion regarding the JSON parsing error "Expecting value: line 1 column 1 (char 0)" when using the Firecrawl tool [1].

To resolve this issue, ensure that the server response is not empty before parsing it as JSON. You can modify the _post_request and _get_request methods to check if the response content is not empty:

def _post_request(self, url, data, headers, retries=3, backoff_factor=0.5):
    for attempt in range(retries):
        response = requests.post(url, headers=headers, json=data)
        if response.status_code == 502:
            time.sleep(backoff_factor * (2**attempt))
        else:
            if response.content:  # Check if response is not empty
                return response
            else:
                raise ValueError("Empty response received")
    return response

def _get_request(self, url, headers, retries=3, backoff_factor=0.5):
    for attempt in range(retries):
        response = requests.get(url, headers=headers)
        if response.status_code == 502:
            time.sleep(backoff_factor * (2**attempt))
        else:
            if response.content:  # Check if response is not empty
                return response
            else:
                raise ValueError("Empty response received")
    return response

This should help prevent the JSON parsing error by handling cases where the server returns an empty response [2][3].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 14, 2024): <!-- Greeting --> @louisLiu1004 Hello there! I'm here to assist you with bug fixes, questions, and contributing to the project. Let's work together to resolve any issues you encounter while waiting for a human maintainer. <!-- Answer --> I found a similar discussion regarding the JSON parsing error "Expecting value: line 1 column 1 (char 0)" when using the Firecrawl tool <sup>[[1]](https://github.com/langgenius/dify/discussions/8604)</sup>. To resolve this issue, ensure that the server response is not empty before parsing it as JSON. You can modify the `_post_request` and `_get_request` methods to check if the response content is not empty: ```python def _post_request(self, url, data, headers, retries=3, backoff_factor=0.5): for attempt in range(retries): response = requests.post(url, headers=headers, json=data) if response.status_code == 502: time.sleep(backoff_factor * (2**attempt)) else: if response.content: # Check if response is not empty return response else: raise ValueError("Empty response received") return response def _get_request(self, url, headers, retries=3, backoff_factor=0.5): for attempt in range(retries): response = requests.get(url, headers=headers) if response.status_code == 502: time.sleep(backoff_factor * (2**attempt)) else: if response.content: # Check if response is not empty return response else: raise ValueError("Empty response received") return response ``` This should help prevent the JSON parsing error by handling cases where the server returns an empty response <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/tools/provider/builtin/firecrawl/firecrawl_appx.py)</sup><sup>[[3]](https://github.com/langgenius/dify/blob/main/api/core/rag/extractor/firecrawl/firecrawl_app.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@n-asuy commented on GitHub (Oct 14, 2024):

I have the same issue. Currently I use JinaReader instead at this moment.
It seems to be not reproduced in Cloud version.

This cloud be related:
https://github.com/langgenius/dify/issues/8792

@n-asuy commented on GitHub (Oct 14, 2024): I have the same issue. Currently I use JinaReader instead at this moment. It seems to be not reproduced in Cloud version. This cloud be related: https://github.com/langgenius/dify/issues/8792
Author
Owner

@hjlarry commented on GitHub (Oct 14, 2024):

can't reproduce, I also use a self-host firecrawl, it works well

@hjlarry commented on GitHub (Oct 14, 2024): can't reproduce, I also use a self-host firecrawl, it works well
Author
Owner

@n-asuy commented on GitHub (Oct 15, 2024):

@hjlarry So any suggestions?

@n-asuy commented on GitHub (Oct 15, 2024): @hjlarry So any suggestions?
Author
Owner

@hjlarry commented on GitHub (Oct 16, 2024):

@hjlarry So any suggestions?

I think you can try the scrape tool of firecrawl first, because it is simpler than the crawl tool.
if it not works, try to debug this line to check what is the response
the firecrawl also supply admin panel http://localhost:3002/admin/@/queues, you can get more information here.

@hjlarry commented on GitHub (Oct 16, 2024): > @hjlarry So any suggestions? I think you can try the scrape tool of firecrawl first, because it is simpler than the crawl tool. if it not works, try to debug this [line](https://github.com/langgenius/dify/blob/7d3dad3d1d2c64379c24184faa22e2ce1ad26490/api/core/tools/provider/builtin/firecrawl/firecrawl_appx.py#L40) to check what is the response the firecrawl also supply admin panel `http://localhost:3002/admin/@/queues`, you can get more information here.
Author
Owner

@TChengZ commented on GitHub (Nov 4, 2024):

can't reproduce, I also use a self-host firecrawl, it works well

do u self-host firecrawl in your computer or in the service, it works well when i self-hosted in my computer,but once i publish it on the service, it won't work

@TChengZ commented on GitHub (Nov 4, 2024): > can't reproduce, I also use a self-host firecrawl, it works well do u self-host firecrawl in your computer or in the service, it works well when i self-hosted in my computer,but once i publish it on the service, it won't work
Author
Owner

@hjlarry commented on GitHub (Nov 4, 2024):

do u self-host firecrawl in your computer or in the service, it works well when i self-hosted in my computer,but once i publish it on the service, it won't work

dify just send a simple http request to the firecrawl server, so the key point to solve this issue is to check what's the response of this request from dify's api server

@hjlarry commented on GitHub (Nov 4, 2024): > do u self-host firecrawl in your computer or in the service, it works well when i self-hosted in my computer,but once i publish it on the service, it won't work dify just send a simple http request to the firecrawl server, so the key point to solve this issue is to check what's the response of this request from dify's api server
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6085