Code review comment: Moved `BPackageSymbol pkgSymbol = importHolder.resolved.symbol;` to the outer loop.   We need that check inside the inner loop to printout the message.

Code under review:
private void defineConstructs(BLangPackage pkgNode, SymbolEnv pkgEnv) {
        
        
        Map<String, ImportResolveHolder> importPkgHolder = new HashMap<>();
        pkgNode.imports.forEach(importNode -> {
            String qualifiedName = importNode.getQualifiedPackageName();
            if (importPkgHolder.containsKey(qualifiedName)) {
                importPkgHolder.get(qualifiedName).unresolved.add(importNode);
                return;
            }
            importPkgHolder.put(qualifiedName, new ImportResolveHolder(importNode));
            defineNode(importNode, pkgEnv);
        });
    
        for (ImportResolveHolder importHolder : importPkgHolder.values()) {
            for (BLangImportPackage unresolvedPkg : importHolder.unresolved) {
                BPackageSymbol pkgSymbol = importHolder.resolved.symbol; 
                                                                         
                if (pkgSymbol == null) {
                    dlog.error(unresolvedPkg.pos, DiagnosticCode.MODULE_NOT_FOUND,
                            unresolvedPkg.getQualifiedPackageName());
                    continue;
                }
                BPackageSymbol importSymbol = importHolder.resolved.symbol;
                Name resolvedPkgAlias = names.fromIdNode(importHolder.resolved.alias);
                Name unresolvedPkgAlias = names.fromIdNode(unresolvedPkg.alias);
    
                
                if (!Names.IGNORE.equals(unresolvedPkgAlias) && unresolvedPkgAlias.equals(resolvedPkgAlias)
                    && importSymbol.compUnit.equals(names.fromIdNode(unresolvedPkg.compUnit))) {
                    if (isSameImport(unresolvedPkg, importSymbol)) {
                        dlog.error(unresolvedPkg.pos, DiagnosticCode.REDECLARED_IMPORT_MODULE,
                                unresolvedPkg.getQualifiedPackageName());
                    } else {
                        dlog.error(unresolvedPkg.pos, DiagnosticCode.REDECLARED_SYMBOL, unresolvedPkgAlias);
                    }
                    continue;
                }
                
                unresolvedPkg.symbol = pkgSymbol;
                
                BPackageSymbol symbol = duplicatePackagSymbol(pkgSymbol);
                symbol.compUnit = names.fromIdNode(unresolvedPkg.compUnit);
                symbol.scope = pkgSymbol.scope;
                unresolvedPkg.symbol = symbol;
                pkgEnv.scope.define(unresolvedPkgAlias, symbol);
            }
        }

        
        this.typePrecedence = 0;

        
        
        
        List<TypeDefinition> typDefs = new ArrayList<>();
        pkgNode.constants.forEach(constant -> typDefs.add(constant));
        pkgNode.typeDefinitions.forEach(typDef -> typDefs.add(typDef));
        defineTypeNodes(typDefs, pkgEnv);

        
        
        pkgEnv.logErrors = true;

        
        pkgNode.typeDefinitions.sort(Comparator.comparing(t -> t.precedence));

        
        defineErrorDetails(pkgNode.typeDefinitions, pkgEnv);

        
        defineFields(pkgNode.typeDefinitions, pkgEnv);

        
        defineMembers(pkgNode.typeDefinitions, pkgEnv);

        
        pkgNode.services.forEach(service -> defineNode(service, pkgEnv));

        
        pkgNode.functions.forEach(func -> defineNode(func, pkgEnv));

        
        pkgNode.annotations.forEach(annot -> defineNode(annot, pkgEnv));

        pkgNode.globalVars.forEach(var -> defineNode(var, pkgEnv));

        
        pkgNode.globalVars.stream().filter(var -> var.symbol.type.tsymbol != null && Symbols
                .isFlagOn(var.symbol.type.tsymbol.flags, Flags.CLIENT)).map(varNode -> varNode.symbol)
                .forEach(varSymbol -> varSymbol.tag = SymTag.ENDPOINT);
    }

Line commented on: dlog.error(unresolvedPkg.pos, DiagnosticCode.MODULE_NOT_FOUND,

Revised code:
private void defineConstructs(BLangPackage pkgNode, SymbolEnv pkgEnv) {
        
        
        Map<String, ImportResolveHolder> importPkgHolder = new HashMap<>();
        pkgNode.imports.forEach(importNode -> {
            String qualifiedName = importNode.getQualifiedPackageName();
            if (importPkgHolder.containsKey(qualifiedName)) {
                importPkgHolder.get(qualifiedName).unresolved.add(importNode);
                return;
            }
            defineNode(importNode, pkgEnv);
            if (importNode.symbol != null) {
                importPkgHolder.put(qualifiedName, new ImportResolveHolder(importNode));
            }
        });

        for (ImportResolveHolder importHolder : importPkgHolder.values()) {
            BPackageSymbol pkgSymbol = importHolder.resolved.symbol; 
            

            for (BLangImportPackage unresolvedPkg : importHolder.unresolved) {
                BPackageSymbol importSymbol = importHolder.resolved.symbol;
                Name resolvedPkgAlias = names.fromIdNode(importHolder.resolved.alias);
                Name unresolvedPkgAlias = names.fromIdNode(unresolvedPkg.alias);

                
                if (!Names.IGNORE.equals(unresolvedPkgAlias) && unresolvedPkgAlias.equals(resolvedPkgAlias)
                    && importSymbol.compUnit.equals(names.fromIdNode(unresolvedPkg.compUnit))) {
                    if (isSameImport(unresolvedPkg, importSymbol)) {
                        dlog.error(unresolvedPkg.pos, DiagnosticCode.REDECLARED_IMPORT_MODULE,
                                unresolvedPkg.getQualifiedPackageName());
                    } else {
                        dlog.error(unresolvedPkg.pos, DiagnosticCode.REDECLARED_SYMBOL, unresolvedPkgAlias);
                    }
                    continue;
                }

                unresolvedPkg.symbol = pkgSymbol;
                
                BPackageSymbol symbol = duplicatePackagSymbol(pkgSymbol);
                symbol.compUnit = names.fromIdNode(unresolvedPkg.compUnit);
                symbol.scope = pkgSymbol.scope;
                unresolvedPkg.symbol = symbol;
                pkgEnv.scope.define(unresolvedPkgAlias, symbol);
            }
        }

        
        this.typePrecedence = 0;

        
        
        
        List<TypeDefinition> typDefs = new ArrayList<>();
        pkgNode.constants.forEach(constant -> typDefs.add(constant));
        pkgNode.typeDefinitions.forEach(typDef -> typDefs.add(typDef));
        defineTypeNodes(typDefs, pkgEnv);

        for (BLangSimpleVariable variable : pkgNode.globalVars) {
            if (variable.expr != null && variable.expr.getKind() == NodeKind.LAMBDA && variable.isDeclaredWithVar) {
                resolveAndSetFunctionTypeFromRHSLambda(variable, pkgEnv);
            }
        }

        
        
        pkgEnv.logErrors = true;

        
        pkgNode.typeDefinitions.sort(Comparator.comparing(t -> t.precedence));

        
        defineErrorDetails(pkgNode.typeDefinitions, pkgEnv);

        
        defineFields(pkgNode.typeDefinitions, pkgEnv);

        
        defineMembers(pkgNode.typeDefinitions, pkgEnv);

        
        pkgNode.services.forEach(service -> defineNode(service, pkgEnv));

        
        pkgNode.functions.forEach(func -> defineNode(func, pkgEnv));

        
        pkgNode.annotations.forEach(annot -> defineNode(annot, pkgEnv));

        pkgNode.globalVars.forEach(var -> defineNode(var, pkgEnv));

        
        pkgNode.globalVars.stream().filter(var -> var.symbol.type.tsymbol != null && Symbols
                .isFlagOn(var.symbol.type.tsymbol.flags, Flags.CLIENT)).map(varNode -> varNode.symbol)
                .forEach(varSymbol -> varSymbol.tag = SymTag.ENDPOINT);
    }