Very limited info here, but I'll try to answer as best I can. There is a bulletin for this issue.99 through 05 GEN III truck engines may experience any of the following: A cold rough idle that diminishes as the engine warms up.
Possible DTCS P0171, P0174, or P0300.
Random misfires at idle.
The intake gasket seals may be leaking around the intake ports, causing a lean condition. The intake gasket seals may leak around the bottom side of the port, making it a challenge to detect the vacuum leak. The technician may also notice lower than normal MAF readings if the intake seals are leaking.
If leaking intake gasket seals are found, replace the intake gaskets. During the repair be sure to use the current GMSPO part number for replacement intake gaskets. The current GMSPO part number for intake gaskets will have a teal green intake gasket seal. The old version of the intake gaskets were orange in color. Use only the teal green colored gaskets for a repair.
The intake plenum should also be checked for excessive warpage that may cause an uneven clamping pressure of the seal. If the plenum is found to be warped it will need to be replaced. Service Information states, " An intake manifold with warpage in excess of 3 mm (0.118 in) over a 200 mm (7.87 in) area should be replaced". Intake warpage is measured at the gasket sealing surfaces, and should be measured within a 200 mm (7.87 in) area. This measurement is across only two of the intake runner port openings. Measurements taken across the entire distance of all four intake runner ports will lead to unnecessary manifold replacements.
Not saying this will fix it but this is a start. Also p0332 is a knock sensor code but the missfir might set p0332 because the knock sensor will advance and retard timing based on engine load so the p0300 might set p0332.