No contradiction, Ezra 3:4 was around 537 BC, I agree. At this time Sheshbazzar was governor of Judah. Note that the exiles merely celebrate the feast, however, they don’t physically gather branches and build booths. As it is written doesn’t specify what writings. Nehemiah, on the other hand specifies according to the Law of Moses, we know those writings. In addition, at this time,these exiles were terrified and likely not interested in wandering around collecting branches, or they likely didn’t know how to fully celebrate.
Ezra 3:3
3So they set up the altar on its foundation, for they were terrified because of the peoples of the lands; and they offered burnt offerings on it to the LORD, burnt offerings morning and evening.>
Ezra 3:4
4They celebrated the Feast of Booths, as it is written, and offered the fixed number of burnt offerings daily, according to the ordinance, as each day required;>
On the other hand, Ezra the scribe, who was skilled in the law of Moses directs the people to do as the Lord had commanded. In the book of Nehemiah, it is clear that special understanding was given in the below passage. The people gather branches and build booths. Note, Nehemiah not Sheshbazzar was governor. Furthermore, the indication below is that the exact content of the commands of the law were discovered (Insight gained) in Nehemiah. See below.
Nehemiah 8:13-17
13Then on the second day the heads of fathers’ households of all the people, the priests and the Levites were gathered to Ezra the scribe that they might gain insight into the words of the law. 14They found written in the law how the LORD had commanded through Moses that the sons of Israel should live in booths during the feast of the seventh month. 15So they proclaimed and circulated a proclamation in all their cities and in Jerusalem, saying, “Go out to the hills, and bring olive branches and wild olive branches, myrtle branches, palm branches and branches of other leafy trees, to make booths, as it is written.” 16So the people went out and brought them and made booths for themselves, each on his roof, and in their courts and in the courts of the house of God, and in the square at the Water Gate and in the square at the Gate of Ephraim. 17The entire assembly of those who had returned from the captivity made booths and lived in them. The sons of Israel had indeed not done so from the days of Joshua the son of Nun to that day. And there was great rejoicing.<
Now this was a celebration shortly after the wall was completed. It was in the twenty somethingth year of Artexerxes. Reign began 465 BC. So we’re looking at around 440-443 BC.
No contradiction, the exiles actively celebrate by building booths in Nehemiah as special insight was given upon examining the law of Moses. Now in Ezra 3 they merely offer sacrifices but don’t build booths. Remember, The exiles were frightened/terrified by the inhabitants upon returning in Ezra 3. The text of Nehemiah suggests the people gained insight at that time. This was during the reign of Artexerxes, as Nehemiah 8 occurred during his reign. A clue is that Nehemiah was governor. On the other hand, Ezra 3 was in the days of Cyrus, many years prior.
In closing, it is my understanding in Ezra, the people celebrated but not by “the letter of the law”. Because of fear and possibly not having understanding. The fact that they were scared to death is an indication that they may not have desired to wander about collecting branches. Furthermore, they likely didn’t have the insight on the specifics of the mandates for the feast of booths.