How to output the forecast hour grib data

Hi,

We are running aifs-v1.0 on our local machine and encountering an issue with the forecast output time steps. Currently, when running a forecast initialized at a specific time (e.g., 2025041700z), the first output in the GRIB file is 6 hours later (2025041706z). I need the output to include the initial forecast hour (t=0). We tried something like:

" # Write the initial state (t=0) to output file first
initial_output_path = os.path.join(self.output_dir, “{}_in.grib”.format(self.DATE))
initial_output = GribFileOutput(runner, initial_output_path)
# Make a copy of input_state to avoid modification issues
initial_state2 = dict(date=self.DATE, fields=input_state[‘fields’].copy(),referenceDate=self.DATE)
initial_output.write_state(initial_state2)
initial_output.close()"

But it fails with a TypeError: “unsupported operand type(s) for -: ‘datetime.datetime’ and ‘NoneType’” in the grib.py file. Has anyone encountered this issue or know how to correctly include the t=0 forecast in the output GRIB files?