diff --git a/news/2337.bugfix.md b/news/2337.bugfix.md
new file mode 100644
index 00000000..81360e3c
--- /dev/null
+++ b/news/2337.bugfix.md
@@ -0,0 +1,1 @@
+Fix list index out of range when build error message is empty.
\ No newline at end of file
diff --git a/news/2342.bugfix.md b/news/2342.bugfix.md
new file mode 100644
index 00000000..55d1cc07
--- /dev/null
+++ b/news/2342.bugfix.md
@@ -0,0 +1,1 @@
+Fix find_link sources being exported as `--extra--index-url`
diff --git a/src/pdm/builders/base.py b/src/pdm/builders/base.py
index 2f43f457..f5275e11 100644
--- a/src/pdm/builders/base.py
+++ b/src/pdm/builders/base.py
@@ -73,7 +73,7 @@ def build_error(e: subprocess.CalledProcessError) -> BuildError:
     """
     output = cast("list[str]", e.output)
     errors: list[str] = []
-    if output[-1].strip().startswith("ModuleNotFoundError"):
+    if output and output[-1].strip().startswith("ModuleNotFoundError"):
         package = output[-1].strip().split()[-1]
         errors.append(
             f"Module {package} is missing, please make sure it is specified in the "
diff --git a/src/pdm/formats/requirements.py b/src/pdm/formats/requirements.py
index f9fdf83d..1da87490 100644
--- a/src/pdm/formats/requirements.py
+++ b/src/pdm/formats/requirements.py
@@ -199,7 +199,13 @@ def export(
         url = source["url"]
         if options.expandvars:
             url = expand_env_vars_in_auth(url)
-        prefix = "--index-url" if source["name"] == "pypi" else "--extra-index-url"
+        source_type = source.get("type", "index")
+        if source_type == "index":
+            prefix = "--index-url" if source["name"] == "pypi" else "--extra-index-url"
+        elif source_type == "find_links":
+            prefix = "--find-links"
+        else:
+            raise ValueError(f"Unknown source type: {source_type}")
         lines.append(f"{prefix} {url}\n")
         if not source.get("verify_ssl", True):
             host = urllib.parse.urlparse(url).hostname

diff --git a/tests/test_formats.py b/tests/test_formats.py
index ea4c1728..b5deba0c 100644
--- a/tests/test_formats.py
+++ b/tests/test_formats.py
@@ -171,6 +171,13 @@ def test_expand_env_vars_in_source(project, monkeypatch):
     assert result.strip().splitlines()[-1] == "--index-url https://foo:bar@test.pypi.org/simple"
 
 
+def test_export_find_links(project, monkeypatch):
+    url = "https://storage.googleapis.com/jax-releases/jax_cuda_releases.html"
+    project.pyproject.settings["source"] = [{"url": url, "name": "jax", "type": "find_links"}]
+    result = requirements.export(project, [], Namespace(expandvars=False))
+    assert result.strip().splitlines()[-1] == f"--find-links {url}"
+
+
 def test_export_replace_project_root(project):
     artifact = FIXTURES / "artifacts/first-2.0.2-py2.py3-none-any.whl"
     shutil.copy2(artifact, project.root)

pdm export requirements does not use --find-links
- [x] I have searched the issue tracker and believe that this is not a duplicate.

## Steps to reproduce
<!--Describe the minimized example of how to reproduce the bug-->
I would like to export a requirements.txt file for installation. In my pyproject.toml I have 

```toml
[project]
dependencies = ['jax[cuda12_pip']
[[tool.pdm.source]]
name = "jax_cuda"
url = "https://storage.googleapis.com/jax-releases/jax_cuda_releases.html"
verify_ssl = true
type = "find_links"
```
However when I export requirements file, these are exposed as `--extra-index-url` as opposed to --find-links.

## Actual behavior

At the end of my exported requirements I get
```
--extra-index-url https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
```

## Expected behavior

I expect the find links in sources to be preserved during export. The above should be 

```
--find-links https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
```

## Environment Information

```bash
# Paste the output of `pdm info && pdm info --env` below:
PDM version:
  2.10.0
Python Interpreter:
  /home/yicheng/project/.venv/bin/python (3.10)
Project Root:
  /home/yicheng/project/
Local Packages:

{
  "implementation_name": "cpython",
  "implementation_version": "3.10.5",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "5.15.0-87-generic",
  "platform_system": "Linux",
  "platform_version": "#97~20.04.1-Ubuntu SMP Thu Oct 5 08:25:28 UTC 2023",
  "python_full_version": "3.10.5",
  "platform_python_implementation": "CPython",
  "python_version": "3.10",
  "sys_platform": "linux"
}
```

tests/test_formats.py::test_export_find_links
tests/test_formats.py::test_convert_pipfile tests/test_formats.py::test_convert_requirements_file[True] tests/test_formats.py::test_convert_requirements_file[False] tests/test_formats.py::test_convert_requirements_file_without_name tests/test_formats.py::test_convert_poetry tests/test_formats.py::test_convert_poetry_12 tests/test_formats.py::test_convert_flit tests/test_formats.py::test_convert_error_preserve_metadata tests/test_formats.py::test_import_requirements_with_group tests/test_formats.py::test_keep_env_vars_in_source tests/test_formats.py::test_expand_env_vars_in_source tests/test_formats.py::test_export_replace_project_root tests/test_formats.py::test_convert_setup_py_project