Skip to content

Neurosynth data failed to get fetched #341

Description

@sophiatinh

Thank you for making this amazing tool available for everyone!

I was trying to use the meta_analytic_decoder function from the Brainstat, however the data didn't get fetched properly (see Warnings and Error messages below). Any advice would be much appreciated!!! I'm currently using MatlabR2021b, if that helps.


>> [correlation, feature] = meta_analytic_decoder(brain,'template', 'fsaverage5');

Downloading Neurosynth files. This may take several minutes.
Warning: Cannot open file "/home/sophia/brainstat_data/neurosynth_data/Neurosynth_TFIDF__lesions_z_desc-consistency.nii.gz" for
reading. 
> In unzip (line 103)
In meta_analytic_decoder>fetch_neurosynth_data (line 92)
In meta_analytic_decoder (line 58)
 
Error using meta_analytic_decoder>fetch_neurosynth_data (line 92)
Invalid ZIP file "/home/sophia/brainstat_data/neurosynth_data/tp28eb81f6_e693_4469_9f82_e203bb4fd907.zip".

Error in meta_analytic_decoder (line 58)
neurosynth_files = fetch_neurosynth_data(options.data_dir);

Activity

  1. zihuaihuai commented on May 4, 2026

    @zihuaihuai
    Collaborator

    Hi @sophiatinh — sorry for the delay on this. The error is from MATLAB's unzip failing on a partially-downloaded archive: the file at ~/brainstat_data/neurosynth_data/tp28eb81f6_..._.zip is a zero-byte or truncated ZIP because the download didn't complete cleanly (the warning two lines up — Cannot open file ... Neurosynth_TFIDF__lesions_z_desc-consistency.nii.gz — is the giveaway).

    The Neurosynth archive is fairly large; on a slow or interrupted connection MATLAB's default webread / websave can time out without raising, leaving the zip half-written, and the next call then tries to unzip a corrupt file.

    To recover:

    rmdir(fullfile(getenv('HOME'), 'brainstat_data', 'neurosynth_data'), 's')

    then re-run meta_analytic_decoder(brain, 'template', 'fsaverage5'). If the download keeps failing on the same machine, the URL meta_analytic_decoder is hitting is recorded in data_urls.json (under neurosynth_precomputed) — you can grab that file manually with curl/wget, drop it (unzipped) into ~/brainstat_data/neurosynth_data/, and meta_analytic_decoder will pick it up and skip the download.

    Could you confirm whether that resolves it? If you still hit the same error after a clean download, it's worth checking your ~/brainstat_data partition for free space.

  2. added
    bugSomething isn't working
    MATLABOn the MATLAB implementation
    on May 4, 2026
  3. zihuaihuai commented on May 4, 2026

    @zihuaihuai
    Collaborator

    Hardened in #380. fetch_neurosynth_data now:

    • Validates the downloaded zip's central directory via java.util.zip.ZipFile before unzip, so a truncated download surfaces a clear error instead of crashing later.
    • Retries the websave + verify + unzip flow up to 3 times, deleting partial zips between attempts.
    • Verifies the post-extract file count matches the manifest and gives a remediation hint if it doesn't.
    • Handles a missing data_dir gracefully.

    If you still hit the same error after the merge, please reopen — likely a transient network issue at that point and worth a fresh trace.

  4. added a commit that references this issue on May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    MATLABOn the MATLAB implementationbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions