@nifier
Your putFile issue is unrelated to original query in this community question. It is better if you start a new community questioon for unrelated queries as solutions can become confusing to others who may use the thread in the future.
That being said, this exception is cause because your NiFi FlowFile has a filename that contains a directory structure:
20242323/year/year.txt
This is not a valid filename to use with putFile processor. I am not sure where in your dataflow before putFile that the filename FlowFile Attribute is being modified in such a way. You might be able to address this issue there (preferred).
You could use an update Attribute processor to extract the directory structure from the filename before putFile processor also.

if you want to maintain the append the extracted path from the filename to "Directory" configured in the putFile processor if you want to create that directory structure.
Please help our community thrive. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.
Thank you,
Matt