##[error]TypeError: paths.flat is not a function

Abhishek Singh 20 Reputation points
2025-03-06T10:59:51.78+00:00

While the build is running, I am getting ##[error]TypeError: paths.flat is not a function error.

We are using # Compress files into .7z, .tar.gz, or .zip. - task: ArchiveFiles@2 task but it is breaking, and I am not sure why.

Error : ##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;]TypeError: paths.flat is not a function (Debug Log)

Can you please help on this. If you need anything else let me know.

Azure DevOps
{count} votes

3 answers

Sort by: Most helpful
  1. Dasari Kamali 425 Reputation points Microsoft External Staff Moderator
    2025-03-14T04:26:46.05+00:00

    Hi @Abhishek Singh

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to accept the answer.

    I don't remember the exact version, but it was 1.* something. I upgraded it to the latest version (4.252.0), and everything started working fine. What is your agent's version? Sometimes, older agents lack backward compatibility with certain tasks, which can cause this type of error.
     

    If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.

    1 person found this answer helpful.
    0 comments No comments

  2. Abhishek Singh 20 Reputation points
    2025-03-08T12:34:04.37+00:00

    I don't remember the exact version, but it was 1.* something. I upgraded it to the latest version (4.252.0), and everything started working fine. What is your agent's version? Sometimes, older agents lack backward compatibility with certain tasks, which can cause this type of error.

    0 comments No comments

  3. Sidhu, Amanpreet 0 Reputation points
    2025-05-21T21:04:31.1+00:00

    I am facing the same issue. Reverting to task version 1.* shows successfull build, but the build folder is empty.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.