{"record":{"id":"ebc6bbcd084e1a4d","repo":"hyperledger/fabric","slug":"chaincode-type-not-supported-s","errorCode":null,"errorMessage":"chaincode type not supported: %s","messagePattern":"chaincode type not supported: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ccaas_builder/cmd/detect/main.go","lineNumber":63,"sourceCode":"\tmetadataFile := filepath.Join(chaincodeMetaData, \"metadata.json\")\n\tif _, err := os.Stat(metadataFile); err != nil {\n\t\treturn errors.WithMessagef(err, \"%s not found \", metadataFile)\n\t}\n\n\t// Read the metadata file\n\tmdbytes, err := os.ReadFile(metadataFile)\n\tif err != nil {\n\t\treturn errors.WithMessagef(err, \"%s not readable\", metadataFile)\n\t}\n\n\tvar metadata chaincodeMetadata\n\terr = json.Unmarshal(mdbytes, &metadata)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"Unable to parse the metadata.json file\")\n\t}\n\n\tif strings.ToLower(metadata.Type) != \"ccaas\" {\n\t\treturn fmt.Errorf(\"chaincode type not supported: %s\", metadata.Type)\n\t}\n\n\t// returning nil indicates to the peer a successful detection\n\treturn nil\n}\n","sourceCodeStart":45,"sourceCodeEnd":69,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/ccaas_builder/cmd/detect/main.go#L45-L69","documentation":"ApplyDatabaseSecurity() builds the security URL by parsing the CouchDB instance URL with url.Parse. If the configured connection URL is malformed (e.g. missing scheme, illegal characters, whitespace), url.Parse fails and the error is wrapped as 'error parsing CouchDB URL: <url>'. The security update is not applied.","triggerScenarios":"Calling ApplyDatabaseSecurity() when couchInstance.url() returns a malformed URL — typically a bad CouchAddress in core.yaml (ledger.state.couchDBConfig.couchDBAddress), a bad address passed to CreateCouchInstance, or one containing spaces/control characters.","commonSituations":"Typo in couchDBAddress (e.g. 'couchdb:5984 ' with trailing space, or missing host), env var substitution leaving placeholders like 'COUCHDB_HOST:5984' unresolved, IPv6 literal without brackets, or misconfigured peer core.yaml after a migration.","solutions":["Fix ledger.state.couchDBConfig.couchDBAddress in the peer's core.yaml (must be host:port, e.g. couchdb:5984)","Check the CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS env override resolves to a real value","Ensure any IPv6 address is bracketed, e.g. [::1]:5984","Log/inspect dbclient.couchInstance.url() and validate it with url.Parse before use","If constructing programmatically, use url.URL fields or net.JoinHostPort instead of string concatenation"],"exampleFix":"// before (core.yaml)\ncouchDBAddress: $COUCHDB_HOST:5984   # unset env -> literal '$COUCHDB_HOST:5984'\n// after\ncouchDBAddress: couchdb:5984","handlingStrategy":"validation","validationCode":"u, err := url.Parse(couchAddress) // couchAddress from core.yaml\nif err != nil || u.Host == \"\" {\n    return fmt.Errorf(\"invalid couchDBAddress %q: %v\", couchAddress, err)\n}","typeGuard":null,"tryCatchPattern":"err := db.ApplyDatabaseSecurity(sec)\nif err != nil && strings.Contains(err.Error(), \"error parsing CouchDB URL\") {\n    // surface the configured address for operators to fix\n    return fmt.Errorf(\"check ledger.state.couchDBConfig.couchDBAddress: %w\", err)\n}","preventionTips":["Always set couchDBAddress as bare host:port, no scheme, no spaces","Use net.JoinHostPort (brackets IPv6 automatically) when constructing addresses","Validate core.yaml with url.Parse in CI or at peer startup","Confirm env placeholders in config actually resolve in the container","Diff config after upgrades before restarting peers"],"tags":["couchdb","url","configuration","fabric"],"backgroundTag":"invalid-couchdb-url","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}