The GenericInterface ConfigItemCreate operation fails with "NIC parameter value is required and is missing!" even when the NIC parameter is correctly provided in the JSON request. Subsequently, the server crashes with a Perl error.
Znuny Version
- Znuny 7.2.3
- ITSMConfigurationManagement 7.2.1
- ITSMCore 7.2.1
- GeneralCatalog 7.2.1
- Docker container with Debian 12 (bookworm)
- MariaDB 10.11
- Perl 5.36.0
- Apache/mod_perl
1. Setup Web Service
Import a web service with ConfigItemCreate operation:
Code: Select all
Provider:
Operation:
ConfigItemCreate:
Description: Create a ConfigItem
MappingInbound:
Type: Simple
MappingOutbound:
Type: Simple
Type: ConfigItem::ConfigItemCreate
Transport:
Config:
RouteOperationMapping:
ConfigItemCreate:
ParserBackend: JSON
RequestMethod:
- POST
Route: /ConfigItem
Type: HTTP::RESTCode: Select all
curl -X POST "http://localhost/znuny/nph-genericinterface.pl/Webservice/API/Session" \
-H "Content-Type: application/json" \
-d '{"UserLogin":"agent","Password":"password"}'Code: Select all
curl -X POST "http://localhost/znuny/nph-genericinterface.pl/Webservice/API/ConfigItem" \
-H "Content-Type: application/json" \
-d '{
"SessionID": "<session_id>",
"ConfigItem": {
"Class": "Computer",
"Name": "Test-Server",
"DeplState": "Production",
"InciState": "Operational",
"CIXMLData": {
"Vendor": "Generic",
"Model": "Generic",
"Description": "Test Server",
"Type": "Server",
"SerialNumber": "SN-001",
"OperatingSystem": "Linux",
"CPU": "Intel",
"Ram": "4 GB",
"HardDisk": "100 GB",
"FQDN": "test-server.local",
"NIC": {
"IPoverDHCP": "No",
"IPAddress": "127.0.0.1"
}
}
}
}'First request returns:
Code: Select all
{
"Error": {
"ErrorCode": "ConfigItemCreate.MissingParameter",
"ErrorMessage": "ConfigItemCreate: ConfigItem->CIXMLData->NIC parameter value is required and is missing!"
}
}Expected Behavior
The ConfigItem should be created successfully when all required parameters including NIC are provided.
Actual Behavior
- The API returns "NIC parameter value is required and is missing!" despite NIC being present in the request
- After a few attempts, the server crashes with a Perl error
From /var/log/apache2/error.log:
Code: Select all
ERROR: GenericInterfaceProvider-10 Perl: 5.36.0 OS: linux
Message: DebugLog error: Summary: ConfigItemCreate.MissingParameter
Data: ConfigItemCreate: ConfigItem->CIXMLData->NIC parameter value is required and is missing!
RemoteAddress: 172.19.0.1
RequestURI: /znuny/nph-genericinterface.pl/Webservice/ZnunyCompleteAPI/ConfigItem
Traceback (206):
Module: Kernel::GenericInterface::Debugger::DebugLog Line: 233
Module: Kernel::GenericInterface::Debugger::Error Line: 327
Module: Kernel::GenericInterface::Operation::Common::ReturnError Line: 120
Module: Kernel::GenericInterface::Operation::ConfigItem::ConfigItemCreate::Run Line: 258
Module: Kernel::GenericInterface::Operation::Run Line: 129
Module: Kernel::GenericInterface::Provider::Run Line: 298Code: Select all
[error] Can't use an undefined value as a HASH reference at
/opt/znuny/Kernel/GenericInterface/Operation/ConfigItem/Common.pm line 1087.All of the following formats produce the same error:
Code: Select all
// Format 1: Object
"NIC": {
"IPoverDHCP": "No",
"IPAddress": "127.0.0.1"
}
// Format 2: Array
"NIC": [{
"IPoverDHCP": "No",
"IPAddress": "127.0.0.1"
}]
// Format 3: With NIC name
"NIC": {
"NIC": "eth0",
"IPoverDHCP": "No",
"IPAddress": "127.0.0.1"
}
// Format 4: Minimal
"NIC": {
"IPoverDHCP": "No"
}The error at ConfigItem/Common.pm line 1087 suggests that the code is trying to access a hash reference that is undefined. This likely occurs because:
- The JSON-to-Perl data structure conversion doesn't match what the ConfigItem module expects for nested/complex fields like NIC
- The validation logic checks for NIC presence before the data is properly parsed/structured
Currently none found. ConfigItem creation via GenericInterface REST API appears to be broken for classes with complex CIXMLData schemas (like the default "Computer" class).
Additional Context
- ConfigItemSearch operation works correctly
- Session creation works correctly
- The same ITSM packages work fine via the web UI
- This was tested with a fresh Znuny 7.2.3 installation with default ITSM class definitions
- Kernel/GenericInterface/Operation/ConfigItem/ConfigItemCreate.pm
- Kernel/GenericInterface/Operation/ConfigItem/Common.pm (line 1087)
This Report was created using Claude Code.