[BUG] Mixture of absolute and relative paths in output of 'Search' tool

Resolved 💬 2 comments Opened Mar 25, 2026 by MaartenBaert Closed Apr 24, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The output of the 'Search' tool contains a seemingly random mixture of absolute and relative paths. For example:

● Search(pattern: "get_datetime_metadata_from_dtype", path: "/tmp/numpy-source/numpy/_core/src/multiarray")
  ⎿  Found 20 lines
     numpy/_core/src/multiarray/datetime_strings.c:1385:    meta = get_datetime_metadata_from_dtype(PyArray_DESCR(op[0]));
     /tmp/numpy-source/numpy/_core/src/multiarray/datetime_strings.c-1386-    if (meta == NULL) {
     /tmp/numpy-source/numpy/_core/src/multiarray/datetime_strings.c-1387-        goto fail;
     /tmp/numpy-source/numpy/_core/src/multiarray/datetime_strings.c-1388-    }
     /tmp/numpy-source/numpy/_core/src/multiarray/datetime_strings.c-1389-
     /tmp/numpy-source/numpy/_core/src/multiarray/datetime_strings.c-1390-    /* Use the metadata's unit for printing by default */
     /tmp/numpy-source/numpy/_core/src/multiarray/datetime_strings.c-1391-    unit = meta->base;
     /tmp/numpy-source/numpy/_core/src/multiarray/datetime_strings.c-1392-
     /tmp/numpy-source/numpy/_core/src/multiarray/datetime_strings.c-1393-    /* Parse the input unit if provided */
     /tmp/numpy-source/numpy/_core/src/multiarray/datetime_strings.c-1394-    if (unit_in != NULL && unit_in != Py_None) {
     /tmp/numpy-source/numpy/_core/src/multiarray/datetime_strings.c-1395-        PyObject *strobj;
     --
     numpy/_core/src/multiarray/arraytypes.c.src:1170:    meta = get_datetime_metadata_from_dtype(PyArray_DESCR(ap));
     /tmp/numpy-source/numpy/_core/src/multiarray/arraytypes.c.src-1171-    if (meta == NULL) {
     /tmp/numpy-source/numpy/_core/src/multiarray/arraytypes.c.src-1172-        return NULL;
     /tmp/numpy-source/numpy/_core/src/multiarray/arraytypes.c.src-1173-    }
     /tmp/numpy-source/numpy/_core/src/multiarray/arraytypes.c.src-1174-
     /tmp/numpy-source/numpy/_core/src/multiarray/arraytypes.c.src-1175-    if ((ap == NULL) || PyArray_ISBEHAVED_RO(ap)) {
     /tmp/numpy-source/numpy/_core/src/multiarray/arraytypes.c.src-1176-        dt = *((npy_datetime *)ip);
     /tmp/numpy-source/numpy/_core/src/multiarray/arraytypes.c.src-1177-    }

The absolute paths are wasting a lot of tokens (this example uses a short path for demonstration purposes, they are usually much longer). This causes the context window to fill up very fast when Claude is searching through the codebase and significantly inflates the cost.

What Should Happen?

The search tool should always print relative paths where possible.

Error Messages/Logs

Steps to Reproduce

Have Claude use the Search tool to search for a pattern in a directory (rather than a single file).

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.83

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Xterm

Additional Information

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗