Problem

You set the paramId or shortName on a given GRIB file but the command fails

Solution

You have a GRIB input file (let's assume it has just one message) and you set the paramId or shortName but it fails. Some examples:

# Example 1
% grib_set -s shortName=clct in.grib out.grib
ECCODES ERROR: concept: no match for shortName=clct
 
# Example 2
% grib_set -s paramId=3125 in.grib out.grib
ECCODES ERROR: concept: no match for paramId=3125
 
# Example 3
% grib_set -s paramId=47 in.grib out.grib
ECCODES ERROR: grib_set_values[5] typeOfStatisticalProcessing (type=long) failed: Key/value not found

Let's look at each failure one by one:

Example 1

If we check the Parameter Database, we see "clct" is defined for centre=cnmc (Italy) and no other centre. So that shortName is not available for GRIB messages with other originating centres. To fix this, we need to change the centre before setting that shortName as follows:

# Example 1 fix
% grib_set -s centre=cnmc,shortName=clct in.grib out.grib

Example 2

Here we see 3125 is defined for GRIB1 but not for GRIB2 therefore this would fail for an input file which is GRIB2. One solution is to use an alternative parameter which has the same meaning but is defined for GRIB2 e.g., 260063 is also "Momentum flux, v component" with the same units.

Example 3

Parameter 47 fails with a different error message. This time it is because the input GRIB has the wrong template (See the FAQ on Product Definition Templates, PDT). Parameter 47 models an accumulation so the input should have a template for accumulated (interval-based) fields rather than instantaneous ones. To fix this we can either select the correct PDT or use the "stepType" key:

# Example 3 first fix
# PDT = 8 means interval-based deterministic (non-ensemble) product
% grib_set -s productDefinitionTemplateNumber=8,paramId=47 in.grib out.grib

Note that there are several such templates (all of which have the key typeOfStatisticalProcessing). For example for chemical or aerosol products it will be a different number (See here for the full list).
The other way of solving this is via setting the stepType key which under the hood selects the PDT:

# Example 3 second fix
% grib_set -s stepType=accum,paramId=47 in.grib out.grib
# Check what it did
% grib_get -p productDefinitionTemplateNumber out.grib
8

Generally it is recommended you use the first solution so you are fully in control of which PDT is set.