binary-husky/gpt_academic · error · GROBID_OFFLINE_EXCEPTION

GROBID服务不可用,请修改config中的GROBID_URL,可修改成本地GROBID服务。

Error message

GROBID服务不可用,请修改config中的GROBID_URL,可修改成本地GROBID服务。

What it means

parse_pdf() calls the GROBID service (via scipdf.parse_pdf_to_dict) to structure a PDF; when the request fails in the specific way recognized as GROBID_OFFLINE_EXCEPTION (service unreachable / connection refused), it is re-raised with this guidance message. GROBID is an external HTTP service whose URL comes from config (GROBID_URL) — default points at a public instance that is often slow or down.

Source

Thrown at crazy_functions/pdf_fns/parse_pdf.py:37

    try:
        _grobid_url = random.choice(GROBID_URLS) # 随机负载均衡
        if _grobid_url.endswith('/'): _grobid_url = _grobid_url.rstrip('/')
        with ProxyNetworkActivate('Connect_Grobid'):
            res = requests.get(_grobid_url+'/api/isalive')
        if res.text=='true': return _grobid_url
        else: return None
    except:
        return None

@lru_cache(maxsize=32)
def parse_pdf(pdf_path, grobid_url):
    import scipdf   # pip install scipdf_parser
    if grobid_url.endswith('/'): grobid_url = grobid_url.rstrip('/')
    try:
        with ProxyNetworkActivate('Connect_Grobid'):
            article_dict = scipdf.parse_pdf_to_dict(pdf_path, grobid_url=grobid_url)
    except GROBID_OFFLINE_EXCEPTION:
        raise GROBID_OFFLINE_EXCEPTION("GROBID服务不可用,请修改config中的GROBID_URL,可修改成本地GROBID服务。")
    except:
        raise RuntimeError("解析PDF失败,请检查PDF是否损坏。")
    return article_dict


def produce_report_markdown(gpt_response_collection, meta, paper_meta_info, chatbot, fp, generated_conclusion_files):
    # -=-=-=-=-=-=-=-= 写出第1个文件:翻译前后混合 -=-=-=-=-=-=-=-=
    res_path = write_history_to_file(meta +  ["# Meta Translation" , paper_meta_info] + gpt_response_collection, file_basename=f"{gen_time_str()}translated_and_original.md", file_fullname=None)
    promote_file_to_downloadzone(res_path, rename_file=os.path.basename(res_path)+'.md', chatbot=chatbot)
    generated_conclusion_files.append(res_path)

    # -=-=-=-=-=-=-=-= 写出第2个文件:仅翻译后的文本 -=-=-=-=-=-=-=-=
    translated_res_array = []
    # 记录当前的大章节标题:
    last_section_name = ""
    for index, value in enumerate(gpt_response_collection):
        # 先挑选偶数序列号:
        if index % 2 != 0:

View on GitHub (pinned to d6bde0fa54)

Solutions

  1. Run GROBID locally: docker run --rm -p 8070:8070 grobid/grobid and set GROBID_URL=http://127.0.0.1:8070
  2. Verify the configured URL responds: curl <GROBID_URL>/api/isalive
  3. If a local service is set, confirm the container/process is actually up and the port matches
  4. Check proxy settings (ProxyNetworkActivate) are not redirecting GROBID traffic incorrectly

Example fix

# before (config)
GROBID_URL = "https://cloud.science-miner.com/grobid/"

# after
docker run -d --name grobid -p 8070:8070 grobid/grobid
GROBID_URL = "http://127.0.0.1:8070"
Defensive patterns

Strategy: validation

Validate before calling

import requests

def grobid_alive(url: str, timeout=5) -> bool:
    try:
        return requests.get(url.rstrip('/') + '/api/isalive', timeout=timeout).ok
    except requests.RequestException:
        return False

if not grobid_alive(grobid_url):
    raise RuntimeError('Start GROBID first: docker run -p 8070:8070 grobid/grobid')

Try / catch

try:
    article = parse_pdf(fp, grobid_url)
except GROBID_OFFLINE_EXCEPTION:
    # fall back to a non-GROBID parser or queue for retry after service start
    article = parse_pdf_fallback(fp)

Prevention

When it happens

Trigger: GROBID_URL points to the default public server which is unreachable, rate-limited, or DNS-fails; a local GROBID container is not started; wrong port; ProxyNetworkActivate('Connect_Grobid') routing the request through a proxy that blocks it.

Common situations: Fresh installs relying on the default remote GROBID; local Docker GROBID not running (docker run grobid/grobid); corporate proxy environments; server behind firewall blocking outbound 8070.

Related errors


AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14). Data as JSON: /api/errors/bc71d18342fc4858. Report an issue: GitHub.