Page MenuHomePhabricator

Incomplete imageinfo API response when file is missing
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

Query the imageinfo API for a file with a file revision that has the file (from storage) missing.

Example: https://en.wikipedia.org/w/api.php?action=query&format=json&prop=imageinfo&titles=File%3ABliss%20(Windows%20XP).png%7Cfile%3A96th_Academy_Awards_Poster.jpeg&formatversion=2&iilimit=max

{
	"action": "query",
	"format": "json",
	"prop": "imageinfo",
	"titles": "File:Bliss (Windows XP).png|file:96th_Academy_Awards_Poster.jpeg",
	"formatversion": "2",
	"iilimit": "max"
}

What happens?:

{
  "batchcomplete": true,
  "query": {
    "normalized": [
      {
        "fromencoded": false,
        "from": "file:96th_Academy_Awards_Poster.jpeg",
        "to": "File:96th Academy Awards Poster.jpeg"
      }
    ],
    "pages": [
      {
        "pageid": 75893231,
        "ns": 6,
        "title": "File:96th Academy Awards Poster.jpeg",
        "imagerepository": "local",
        "imageinfo": [
          {
            "timestamp": "2026-03-16T03:00:52Z",
            "user": "Stevencocoboy"
          },
          {
            "filemissing": true
          },
          {
            "timestamp": "2024-01-23T14:26:09Z",
            "user": "HM2021",
            "filehidden": true
          },
          {
            "timestamp": "2024-01-23T14:21:49Z",
            "user": "Pablo.pk23",
            "filehidden": true
          }
        ]
      },
      {
        "pageid": 79608179,
        "ns": 6,
        "title": "File:Bliss (Windows XP).png",
        "imagerepository": "local",
        "imageinfo": [
          {
            "timestamp": "2026-05-14T21:34:59Z",
            "user": "Nutella lover"
          },
          {
            "timestamp": "2025-04-01T20:09:43Z",
            "user": "Queen of Hearts"
          },
          {
            "timestamp": "2017-04-08T22:13:42Z",
            "user": "Ayane m",
            "filehidden": true
          },
          {
            "timestamp": "2012-09-19T10:00:38Z",
            "user": "AussieLegend",
            "filehidden": true
          },
          {
            "filehidden": true
          },
          {
            "timestamp": "2008-03-06T22:13:33Z",
            "user": "Cody-7",
            "filehidden": true
          },
          {
            "timestamp": "2007-06-07T13:53:35Z",
            "user": "Vanderdecken",
            "filehidden": true
          },
          {
            "timestamp": "2006-06-09T03:21:39Z",
            "user": "Kbolino",
            "filehidden": true
          },
          {
            "timestamp": "2006-06-05T18:26:03Z",
            "user": "Vanderdecken",
            "filehidden": true
          },
          {
            "timestamp": "2006-04-24T17:04:03Z",
            "user": "Eliashc",
            "filehidden": true
          },
          {
            "timestamp": "2006-04-20T08:37:37Z",
            "user": "Jeremy Visser",
            "filehidden": true
          },
          {
            "timestamp": "2006-04-11T13:05:51Z",
            "user": "Vanderdecken",
            "filehidden": true
          }
        ]
      }
    ]
  },
  "limits": {
    "imageinfo": 500
  }
}

Note the incomplete

{
  "filemissing": true
}
{
  "filehidden": true
}

What should have happened instead?:

{
  "batchcomplete": true,
  "query": {
    "normalized": [
      {
        "fromencoded": false,
        "from": "file:96th_Academy_Awards_Poster.jpeg",
        "to": "File:96th Academy Awards Poster.jpeg"
      }
    ],
    "pages": [
      {
        "pageid": 75893231,
        "ns": 6,
        "title": "File:96th Academy Awards Poster.jpeg",
        "imagerepository": "local",
        "imageinfo": [
          {
            "timestamp": "2026-03-16T03:00:52Z",
            "user": "Stevencocoboy"
          },
          {
            "timestamp": "2024-01-23T19:43:52Z",
            "user": "Yoshiman6464",
            "filemissing": true
          },
          {
            "timestamp": "2024-01-23T14:26:09Z",
            "user": "HM2021",
            "filehidden": true
          },
          {
            "timestamp": "2024-01-23T14:21:49Z",
            "user": "Pablo.pk23",
            "filehidden": true
          }
        ]
      },
      {
        "pageid": 79608179,
        "ns": 6,
        "title": "File:Bliss (Windows XP).png",
        "imagerepository": "local",
        "imageinfo": [
          {
            "timestamp": "2026-05-14T21:34:59Z",
            "user": "Nutella lover"
          },
          {
            "timestamp": "2025-04-01T20:09:43Z",
            "user": "Queen of Hearts"
          },
          {
            "timestamp": "2017-04-08T22:13:42Z",
            "user": "Ayane m",
            "filehidden": true
          },
          {
            "timestamp": "2012-09-19T10:00:38Z",
            "user": "AussieLegend",
            "filehidden": true
          },
          {
            "timestamp": "2010-05-01T16:50:33Z",
            "user": "A:-)Brunuś",
            "filehidden": true
          },
          {
            "timestamp": "2008-03-06T22:13:33Z",
            "user": "Cody-7",
            "filehidden": true
          },
          {
            "timestamp": "2007-06-07T13:53:35Z",
            "user": "Vanderdecken",
            "filehidden": true
          },
          {
            "timestamp": "2006-06-09T03:21:39Z",
            "user": "Kbolino",
            "filehidden": true
          },
          {
            "timestamp": "2006-06-05T18:26:03Z",
            "user": "Vanderdecken",
            "filehidden": true
          },
          {
            "timestamp": "2006-04-24T17:04:03Z",
            "user": "Eliashc",
            "filehidden": true
          },
          {
            "timestamp": "2006-04-20T08:37:37Z",
            "user": "Jeremy Visser",
            "filehidden": true
          },
          {
            "timestamp": "2006-04-11T13:05:51Z",
            "user": "Vanderdecken",
            "filehidden": true
          }
        ]
      }
    ]
  },
  "limits": {
    "imageinfo": 500
  }
}

Note the complete

{
  "timestamp": "2024-01-23T19:43:52Z",
  "user": "Yoshiman6464",
  "filemissing": true
}
{
  "timestamp": "2010-05-01T16:50:33Z",
  "user": "A:-)Brunuś",
  "filehidden": true
}

Other information (browser name/version, screenshots, etc.):

Event Timeline

I looked at it a bit (not a lot so it might be wrong) but the data is there in the new tables:

|   63116 |   42207 |   38627 |      248 |       367 | {"data":{"MEDIAWIKI_EXIF_VERSION":2}}                 |       8 |          71391841 |     55477 | 20240123194352 | 8sl78ncohe8tibkk84fyg3ud75e2xy9 |                                                |          0 |

The data is displayed in the web UI but is missing from the API response.

This looks closely related to (and possibly a duplicate of) T239213, which describes the same imageinfo API behavior for filemissing revisions.

Change #1292627 had a related patch set uploaded (by HakanIST; author: HakanIST):

[mediawiki/core@master] imageinfo: Include metadata for file revisions with missing blobs

https://gerrit.wikimedia.org/r/1292627

Aklapper renamed this task from Inccomplete imageinfo API response when file is missing to Incomplete imageinfo API response when file is missing.Sat, May 23, 10:16 AM

Change #1292627 merged by jenkins-bot:

[mediawiki/core@master] imageinfo: Include metadata for file revisions with missing blobs

https://gerrit.wikimedia.org/r/1292627

This looks closely related to (and possibly a duplicate of) T239213, which describes the same imageinfo API behavior for filemissing revisions.

Yea, I guess the new issue here was that the below case had neither filemissing or metadata.

{
  "filehidden": true
}

Yea, I guess the new issue here was that the below case had neither filemissing or metadata.

{
  "filehidden": true
}

Correct, this fix addresses both the filemissing-without-metadata and the filehidden-without-metadata cases, now deployed to all wikis.